Back to index

glibc  2.9
Functions
gmon.h File Reference
#include <gmon/sys/gmon.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void __write_profiling (void)
void write_profiling (void)
void __bb_init_func (struct __bb *bb)
void __bb_exit_func (void)

Function Documentation

void __bb_exit_func ( void  )

Definition at line 38 of file bb_exit_func.c.

{
  const int version = GMON_VERSION;
  struct gmon_hdr ghdr;
  struct __bb *ptr;
  FILE *fp;
  fp = fopen (OUT_NAME, "wb");
  if (!fp)
    {
      perror (OUT_NAME);
      return;
    }
  /* No threads use this stream.  */
  __fsetlocking (fp, FSETLOCKING_BYCALLER);

  memcpy (&ghdr.cookie[0], GMON_MAGIC, 4);
  memcpy (&ghdr.version, &version, sizeof (version));
  fwrite_unlocked (&ghdr, sizeof (ghdr), 1, fp);

  for (ptr = __bb_head; ptr != 0; ptr = ptr->next)
    {
      u_int ncounts = ptr->ncounts;
      u_char tag;
      u_int i;

      tag = GMON_TAG_BB_COUNT;
      fwrite_unlocked (&tag, sizeof (tag), 1, fp);
      fwrite_unlocked (&ncounts, sizeof (ncounts), 1, fp);

      for (i = 0; i < ncounts; ++i)
       {
         fwrite_unlocked (&ptr->addresses[i], sizeof (ptr->addresses[0]), 1,
                        fp);
         fwrite_unlocked (&ptr->counts[i], sizeof (ptr->counts[0]), 1, fp);
       }
    }
  fclose (fp);
}

Here is the call graph for this function:

void __bb_init_func ( struct __bb bb)

Definition at line 32 of file bb_init_func.c.

{
  struct gmonparam *p = &_gmonparam;

  if (bb->zero_word != 0)
    {
      return; /* handle common case quickly */
    }

  /* insert this basic-block into basic-block list: */
  bb->zero_word = 1;
  bb->next = __bb_head;
  __bb_head = bb;

  if (bb->next == 0 && p->state != GMON_PROF_ON)
    {
      /* we didn't register _mcleanup yet and pc profiling doesn't seem
        to be active, so let's register it now: */
      extern void *__dso_handle __attribute__ ((__weak__));
      __cxa_atexit ((void (*) (void *)) _mcleanup, NULL,
                  &__dso_handle ? __dso_handle : NULL);
    }
}

Here is the call graph for this function:

void __write_profiling ( void  )

Definition at line 372 of file gmon.c.

{
  int save = _gmonparam.state;
  _gmonparam.state = GMON_PROF_OFF;
  if (save == GMON_PROF_ON)
    write_gmon ();
  _gmonparam.state = save;
}

Here is the call graph for this function:

void write_profiling ( void  )