[go: up one dir, main page]

Menu

[897c37]: / runtime / profile.c  Maximize  Restore  History

Download this file

31 lines (26 with data), 733 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
LPC Profiling module; works by alarming every second
and gathering statistics on whether or not the stack
machine is executing at that time. If it is it determines
in what object:function and adds this to the profile
data. This data can be accessed via the PROFILE()
efun which returns the raw data for processing.
(oh well - you gotta use dumpallobj at the moment).
Geoff Wong, 1994
See the file "Copying" distributed with this file.
*/
/* It's not working yet :-) */
extern int executing;
/* this gets called by the alarm */
int doing_prog = 0, doing_other = 0;
profile()
{
if (executing) {
doing_prog++;
if (Scurrent()) Scurrent()->prof++;
}
else {
doing_other++;
}
signal(SIGUSR1, profile);
}