pspsdk-1.0+beta2
prof.c File Reference
#include <stdlib.h>
#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include <pspthreadman.h>
Include dependency graph for prof.c:

Data Structures

struct  gmonhdr
 gmon.out file header More...
struct  rawarc
 frompc -> selfpc graph More...
struct  gmonparam
 context More...

Macros

#define GMON_PROF_ON   0
#define GMON_PROF_BUSY   1
#define GMON_PROF_ERROR   2
#define GMON_PROF_OFF   3
#define GMONVERSION   0x00051879
#define HISTFRACTION   4
 one histogram per four bytes of text space
#define SAMPLE_FREQ   1000
 define sample frequency - 1000 hz = 1ms

Functions

void gprof_cleanup ()
 Writes gmon.out dump file and stops profiling.
void __mcount (unsigned int frompc, unsigned int selfpc)
 Internal C handler for _mcount()

Variables

int _ftext
 defined by linker
int _etext

Macro Definition Documentation

#define GMON_PROF_BUSY   1
#define GMON_PROF_ERROR   2
#define GMON_PROF_OFF   3

Referenced by gprof_cleanup().

#define GMON_PROF_ON   0

Referenced by __mcount(), and gprof_cleanup().

#define GMONVERSION   0x00051879

Referenced by gprof_cleanup().

#define HISTFRACTION   4

one histogram per four bytes of text space

#define SAMPLE_FREQ   1000

define sample frequency - 1000 hz = 1ms

Referenced by gprof_cleanup().

Function Documentation

void __mcount ( unsigned int  frompc,
unsigned int  selfpc 
)

Internal C handler for _mcount()

Parameters
frompcpc address of caller
selfpcpc address of current function

Called from mcount.S to make life a bit easier. __mcount is called right before a function starts. GCC generates a tiny stub at the very beginning of each compiled routine, which eventually brings the control to here.

References rawarc::count, rawarc::frompc, GMON_PROF_ON, gp, and rawarc::selfpc.

void gprof_cleanup ( )

Writes gmon.out dump file and stops profiling.

Called from atexit() handler; will dump out a host:gmon.out file with all collected information.

References fclose(), fopen(), fp, fwrite(), GMON_PROF_OFF, GMON_PROF_ON, GMONVERSION, gp, gmonhdr::hpc, i, gmonhdr::lpc, gmonhdr::ncnt, gmonhdr::profrate, gmonhdr::resv, SAMPLE_FREQ, sceKernelStopVTimer(), and gmonhdr::version.

Variable Documentation

int _etext
int _ftext

defined by linker