profile.h File Reference

Profiling. More...

#include <stdint.h>

Go to the source code of this file.

Data Structures

union  profiler
 A data structure for storing profiling information. More...

Functions

 FILE_LICENCE (GPL2_OR_LATER)
static __attribute__ ((always_inline)) unsigned long profile(union profiler *profiler)
 Perform profiling.

Variables

static union profiler simple_profiler
 Static per-object profiler, for use with simple_profile().


Detailed Description

Profiling.

Definition in file profile.h.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER   ) 

static __attribute__ ( (always_inline)   )  [inline, static]

Perform profiling.

Parameters:
profiler Profiler data structure
Return values:
delta Elapsed ticks since last call to profile().
Call profile() both before and after the code you wish to measure. The "after" call will return the measurement. For example:

     profile ( &profiler );
     ... do something here ...
     printf ( "It took %ld ticks to execute\n", profile ( &profiler ) );

Return values:
delta Elapsed ticks since last call to profile().
When you only need one profiler, you can avoid the hassle of creating your own profiler data structure by using simple_profile() instead.

simple_profile() is equivalent to profile(&simple_profiler), where simple_profiler is a profiler data structure that is static to each object which includes profile.h.

Definition at line 52 of file profile.h.

References __asm__().

00053                                      {
00054         uint64_t last_timestamp = profiler->timestamp;
00055 
00056         __asm__ __volatile__ ( "rdtsc" :
00057                                "=a" ( profiler->rdtsc.eax ),
00058                                "=d" ( profiler->rdtsc.edx ) );
00059         return ( profiler->timestamp - last_timestamp );
00060 }


Variable Documentation

union profiler simple_profiler [static]

Static per-object profiler, for use with simple_profile().

Definition at line 33 of file profile.h.


Generated on Tue Apr 6 20:01:52 2010 for gPXE by  doxygen 1.5.7.1