xref: /plan9-contrib/sys/src/cmd/ptrace/all.h (revision af198995f3f1f1d87a386835b2bcd15ca90a6fed)
1 #include <u.h>
2 #include <libc.h>
3 #include <bio.h>
4 #include <thread.h>
5 #include <ptrace.h>
6 
7 #include <draw.h>
8 #include <cursor.h>
9 #include <keyboard.h>
10 #include <mouse.h>
11 #include <plumb.h>
12 
13 typedef struct St St;
14 typedef struct Proc Proc;
15 
16 enum
17 {
18 	Dump = 1,
19 	Plot = 2,
20 
21 	Stack = 32*1024,
22 	Incr = 4096,
23 
24 	Wx = 718,		/* default window sizes */
25 	Wy = 400,
26 	Wid = 3,		/* line width */
27 	Scroll = 10,	/* fraction of screen in scrolls */
28 };
29 
30 struct St
31 {
32 	PTraceevent;
33 	int state;		/* Sready, Srun, Ssleep */
34 	char *name;
35 
36 	/* help for browsing */
37 	int x;			/* min x in screen when shown */
38 	int pnext;		/* next event index in graph[] for this proc */
39 };
40 
41 struct Proc
42 {
43 	int pid;
44 	int* state;		/* indexes in graph[] for state changes */
45 	int nstate;
46 
47 	int row;		/* used to plot this process */
48 	int s0, send;	/* slice in state[] shown */
49 
50 	int *pnextp;		/* help for building St.next list */
51 };
52 
53 #define NS(x)	((vlong)x)
54 #define US(x)	(NS(x) * 1000ULL)
55 #define MS(x)	(US(x) * 1000ULL)
56 #define S(x)	(MS(x) * 1000ULL)
57 
58 #pragma	varargck	type	"T"		vlong
59 #pragma	varargck	type	"G"		St*
60 
61 extern Biobuf *bout;
62 extern int what, verb, newwin;
63 extern St **graph;
64 extern int ngraph;
65 extern Proc *proc;
66 extern int nproc;
67 
68 /*
69  | c/f2p st.c
70  */
71 extern int	Gfmt(Fmt *f);
72 extern int	Tfmt(Fmt *f);
73 extern void	makeprocs(void);
74 extern St*	pgraph(Proc *p, int i);
75 extern void	readall(char *f, int isdev);
76