add dtracy support to mkdevc and enable dtracy with plan9.ini
This commit is contained in:
parent
e93a85710e
commit
6f30420136
|
@ -67,6 +67,7 @@ LIB=\
|
|||
/$objtype/lib/libmp.a\
|
||||
/$objtype/lib/libfis.a\
|
||||
/$objtype/lib/libaml.a\
|
||||
/$objtype/lib/libdtracy.a\
|
||||
|
||||
ETHER=`{echo devether.c ether*.c | sed 's/\.c/.'$O'/g'}
|
||||
AUDIO=`{echo devaudio.c audio*.c | sed 's/\.c/.'$O'/g'}
|
||||
|
|
|
@ -18,6 +18,7 @@ dev
|
|||
cap
|
||||
kprof
|
||||
fs
|
||||
dtracy
|
||||
|
||||
ether netif
|
||||
bridge netif log
|
||||
|
@ -137,6 +138,9 @@ misc
|
|||
vgatvp3026 =cur
|
||||
vgavesa
|
||||
vgavmware +cur
|
||||
|
||||
dtracysys
|
||||
dtracytimer
|
||||
|
||||
ip
|
||||
tcp
|
||||
|
|
|
@ -65,6 +65,7 @@ LIB=\
|
|||
/$objtype/lib/libc.a\
|
||||
/$objtype/lib/libfis.a\
|
||||
/$objtype/lib/libaml.a\
|
||||
/$objtype/lib/libdtracy.a\
|
||||
|
||||
ETHER=`{cd ../pc; echo devether.c ether*.c | sed 's/\.c/.'$O'/g'}
|
||||
AUDIO=`{cd ../pc; echo devaudio.c audio*.c | sed 's/\.c/.'$O'/g'}
|
||||
|
|
|
@ -41,6 +41,7 @@ dev
|
|||
|
||||
segment
|
||||
vmx
|
||||
dtracy
|
||||
|
||||
link
|
||||
# devpccard
|
||||
|
@ -136,6 +137,9 @@ misc
|
|||
vgavesa
|
||||
# vgavmware +cur
|
||||
|
||||
dtracysys
|
||||
dtracytimer
|
||||
|
||||
ip
|
||||
tcp
|
||||
udp
|
||||
|
|
|
@ -125,9 +125,13 @@ dtkfree(DTKChan *p)
|
|||
dtktab[idx] = nil;
|
||||
}
|
||||
|
||||
static int dtracyen;
|
||||
|
||||
static void
|
||||
dtracyinit(void)
|
||||
{
|
||||
dtracyen = getconf("*dtracy") != nil;
|
||||
if(!dtracyen) return;
|
||||
machlocks = smalloc(sizeof(Lock) * conf.nmach);
|
||||
dtinit(conf.nmach);
|
||||
}
|
||||
|
@ -135,6 +139,8 @@ dtracyinit(void)
|
|||
static Chan*
|
||||
dtracyattach(char *spec)
|
||||
{
|
||||
if(!dtracyen)
|
||||
error("*dtracy= not set");
|
||||
return devattach(L'Δ', spec);
|
||||
}
|
||||
|
||||
|
@ -519,60 +525,3 @@ dtpeek(uvlong addr, void *buf, int len)
|
|||
memmove(buf, (void *) addr, len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DTProbe *timerprobe;
|
||||
|
||||
static void
|
||||
dtracytimer(void *)
|
||||
{
|
||||
DTTrigInfo info;
|
||||
|
||||
memset(&info, 0, sizeof(info));
|
||||
for(;;){
|
||||
tsleep(&up->sleep, return0, nil, 1000);
|
||||
dtptrigger(timerprobe, m->machno, &info);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
timerprovide(DTProvider *prov, DTName)
|
||||
{
|
||||
static int provided;
|
||||
|
||||
if(provided) return;
|
||||
provided = 1;
|
||||
timerprobe = dtpnew((DTName){"timer", "", "1s"}, prov, nil);
|
||||
}
|
||||
|
||||
static int
|
||||
timerenable(DTProbe *)
|
||||
{
|
||||
static int gotkproc;
|
||||
|
||||
if(!gotkproc){
|
||||
kproc("dtracytimer", dtracytimer, nil);
|
||||
gotkproc=1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
timerdisable(DTProbe *)
|
||||
{
|
||||
}
|
||||
|
||||
DTProvider dtracyprov_timer = {
|
||||
.name = "timer",
|
||||
.provide = timerprovide,
|
||||
.enable = timerenable,
|
||||
.disable = timerdisable,
|
||||
};
|
||||
|
||||
extern DTProvider dtracyprov_sys;
|
||||
|
||||
DTProvider *dtproviders[] = {
|
||||
&dtracyprov_timer,
|
||||
&dtracyprov_sys,
|
||||
nil,
|
||||
};
|
||||
|
||||
|
|
|
@ -260,7 +260,7 @@ sysdisable(DTProbe *p)
|
|||
z = systab[i], systab[i] = wraptab[i], wraptab[i] = z;
|
||||
}
|
||||
|
||||
DTProvider dtracyprov_sys = {
|
||||
DTProvider dtracysysprov = {
|
||||
.name = "sys",
|
||||
.provide = sysprovide,
|
||||
.enable = sysenable,
|
||||
|
|
56
sys/src/9/port/dtracytimer.c
Normal file
56
sys/src/9/port/dtracytimer.c
Normal file
|
@ -0,0 +1,56 @@
|
|||
#include "u.h"
|
||||
#include "../port/lib.h"
|
||||
#include "mem.h"
|
||||
#include "dat.h"
|
||||
#include "fns.h"
|
||||
#include "../port/error.h"
|
||||
|
||||
#include <dtracy.h>
|
||||
|
||||
static DTProbe *timerprobe;
|
||||
|
||||
static void
|
||||
dtracytimer(void *)
|
||||
{
|
||||
DTTrigInfo info;
|
||||
|
||||
memset(&info, 0, sizeof(info));
|
||||
for(;;){
|
||||
tsleep(&up->sleep, return0, nil, 1000);
|
||||
dtptrigger(timerprobe, m->machno, &info);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
timerprovide(DTProvider *prov, DTName)
|
||||
{
|
||||
static int provided;
|
||||
|
||||
if(provided) return;
|
||||
provided = 1;
|
||||
timerprobe = dtpnew((DTName){"timer", "", "1s"}, prov, nil);
|
||||
}
|
||||
|
||||
static int
|
||||
timerenable(DTProbe *)
|
||||
{
|
||||
static int gotkproc;
|
||||
|
||||
if(!gotkproc){
|
||||
kproc("dtracytimer", dtracytimer, nil);
|
||||
gotkproc=1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
timerdisable(DTProbe *)
|
||||
{
|
||||
}
|
||||
|
||||
DTProvider dtracytimerprov = {
|
||||
.name = "timer",
|
||||
.provide = timerprovide,
|
||||
.enable = timerenable,
|
||||
.disable = timerdisable,
|
||||
};
|
|
@ -58,7 +58,8 @@ collect && section == "misc"{
|
|||
if($i ~ "[+=]cur")
|
||||
vgacur[nvgacur++] = $1;
|
||||
}
|
||||
}
|
||||
}else if($1 ~ "^dtracy.*")
|
||||
dtracyprov[ndtracyprov++] = $1;
|
||||
}
|
||||
|
||||
collect && section == "port"{
|
||||
|
@ -190,6 +191,16 @@ END{
|
|||
printf "%s\n", port[i];
|
||||
printf "\n";
|
||||
}
|
||||
|
||||
if(ndtracyprov){
|
||||
printf "#include <dtracy.h>\n";
|
||||
for(i = 0; i < ndtracyprov; i++)
|
||||
printf "extern DTProvider %sprov;\n", dtracyprov[i]
|
||||
printf "DTProvider *dtproviders[] = {\n"
|
||||
for(i = 0; i < ndtracyprov; i++)
|
||||
printf "\t&%sprov,\n", dtracyprov[i]
|
||||
printf "\tnil,\n};\n\n"
|
||||
}
|
||||
|
||||
printf "char* conffile = \"%s/%s\";\n", pwd, ARGV[1];
|
||||
printf "ulong kerndate = KERNDATE;\n";
|
||||
|
|
Loading…
Reference in a new issue