]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/port/dtracytimer.c
kernel: use 64-bit virtual entry point for expanded header, document behaviour in...
[plan9front.git] / sys / src / 9 / port / dtracytimer.c
1 #include        "u.h"
2 #include        "../port/lib.h"
3 #include        "mem.h"
4 #include        "dat.h"
5 #include        "fns.h"
6 #include        "../port/error.h"
7
8 #include        <dtracy.h>
9
10 static DTProbe *timerprobe;
11
12 static void
13 dtracytimer(void *)
14 {
15         DTTrigInfo info;
16
17         memset(&info, 0, sizeof(info));
18         for(;;){
19                 tsleep(&up->sleep, return0, nil, 1000);
20                 dtptrigger(timerprobe, &info);
21         }
22 }
23
24 static void
25 timerprovide(DTProvider *prov)
26 {
27         timerprobe = dtpnew("timer::1s", prov, nil);
28 }
29
30 static int
31 timerenable(DTProbe *)
32 {
33         static int gotkproc;
34         
35         if(!gotkproc){
36                 kproc("dtracytimer", dtracytimer, nil);
37                 gotkproc=1;
38         }
39         return 0;
40 }
41
42 static void
43 timerdisable(DTProbe *)
44 {
45 }
46
47 DTProvider dtracytimerprov = {
48         .name = "timer",
49         .provide = timerprovide,
50         .enable = timerenable,
51         .disable = timerdisable,
52 };