-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphase_1.d
189 lines (148 loc) · 4.59 KB
/
phase_1.d
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#!/usr/sbin/dtrace -s
BEGIN
{
/*
Let INFrame = time in IN_Frame
COMFrame = time in Com_Frame
Ping = time in SV_CalcPings
RunFrame = time in VM_Call(GAME_RUN_FRAME)
Timeout = time in SV_CheckTimeouts
Send = time in SV_SendClientMessages
Player = time per player in ClientThink_Real
Units are microseconds. `vtimestamp` returns nanoseconds.
Parameters (as always): N = total number of logged-in users
For each variable (INFrame,...Send), we'll have a pure average here,
and a histogram in @.
*/
INFrame_tmp = 0;
INFrame_ttl = 0;
INFrame_cnt = 0;
COMFrame_tmp = 0;
COMFrame_ttl = 0;
COMFrame_cnt = 0;
Ping_tmp = 0;
Ping_ttl = 0;
Ping_cnt = 0;
/* The last arg1 for VM_Call that we tracked. Used for the :return */
vm_mode = -1;
RunFrame_tmp = 0;
RunFrame_ttl = 0;
RunFrame_cnt = 0;
Timeout_tmp = 0;
Timeout_ttl = 0;
Timeout_cnt = 0;
Send_tmp = 0;
Send_ttl = 0;
Send_cnt = 0;
Player_tmp = 0;
Player_ttl = 0;
Player_cnt = 0;
t_total = walltimestamp;
}
pid$1::IN_Frame:entry
{
INFrame_tmp = vtimestamp;
}
pid$1::IN_Frame:return
{
INFrame_tmp = (vtimestamp - INFrame_tmp);
@["INFrame"] = quantize(INFrame_tmp/1000);
INFrame_cnt++;
INFrame_ttl += INFrame_tmp;
}
pid$1::Com_Frame:entry
{
COMFrame_tmp = vtimestamp;
}
pid$1::Com_Frame:return
{
COMFrame_tmp = (vtimestamp - COMFrame_tmp);
@["COMFrame"] = quantize(COMFrame_tmp/1000);
COMFrame_cnt++;
COMFrame_ttl += COMFrame_tmp;
}
pid$1::SV_CalcPings:entry
{
Ping_tmp = vtimestamp;
}
pid$1::SV_CalcPings:return
{
Ping_tmp = (vtimestamp - Ping_tmp);
@["Ping"] = quantize(Ping_tmp/1000);
Ping_cnt++;
Ping_ttl += Ping_tmp;
}
/* SV_Frame: VM_Call(gvm, GAME_RUN_FRAME (8), sv.time) */
pid$1::VM_Call:entry
/arg1 == 8/
{
RunFrame_tmp = vtimestamp;
vm_mode = 8;
}
pid$1::VM_Call:return
/vm_mode == 8/
{
RunFrame_tmp = (vtimestamp - RunFrame_tmp);
@["RunFrame"] = quantize(RunFrame_tmp/1000);
RunFrame_cnt++;
RunFrame_ttl += RunFrame_tmp;
vm_mode = -1;
}
pid$1::SV_CheckTimeouts:entry
{
Timeout_tmp = vtimestamp;
}
pid$1::SV_CheckTimeouts:return
{
Timeout_tmp = (vtimestamp - Timeout_tmp);
@["Timeout"] = quantize(Timeout_tmp/1000);
Timeout_cnt++;
Timeout_ttl += Timeout_tmp;
}
pid$1::SV_SendClientMessages:entry
{
Send_tmp = vtimestamp;
}
pid$1::SV_SendClientMessages:return
/Send_tmp != 0/
{
Send_tmp = (vtimestamp - Send_tmp);
@["Send"] = quantize(Send_tmp/1000);
Send_cnt++;
Send_ttl += Send_tmp;
}
quake$1:::sim-player-start
{
Player_tmp = vtimestamp;
}
quake$1:::sim-player-abort
{
Player_tmp = -1;
}
quake$1:::sim-player-end
/ Player_tmp != -1 /
{
Player_tmp = (vtimestamp - Player_tmp);
@["Player"] = quantize(Player_tmp/1000);
Player_cnt++;
Player_ttl += Player_tmp;
}
END {
t_total = (walltimestamp - t_total) / 1000;
printf("\n");
printf("Total Running time: %d usec\n", t_total);
printf("INFrame Average: %d nanoseconds\n", INFrame_ttl / (INFrame_cnt == 0? 1:INFrame_cnt));
printf(" NSamples: %d. Valid: %s\n", INFrame_cnt, (INFrame_cnt == 0)? "NO": "yes");
printf("COMFrame Average: %d nanoseconds\n", COMFrame_ttl / (COMFrame_cnt == 0? 1:COMFrame_cnt));
printf(" NSamples: %d. Valid: %s\n", COMFrame_cnt, (COMFrame_cnt == 0)? "NO": "yes");
printf("Ping Average: %d nanoseconds\n", Ping_ttl / (Ping_cnt == 0? 1:Ping_cnt));
printf(" NSamples: %d. Valid: %s\n", Ping_cnt, (Ping_cnt == 0)? "NO": "yes");
printf("RunFrame Average: %d nanoseconds\n", RunFrame_ttl / (RunFrame_cnt == 0? 1:RunFrame_cnt));
printf(" NSamples: %d. Valid: %s\n", RunFrame_cnt, (RunFrame_cnt == 0)? "NO": "yes");
printf("Timeout Average: %d nanoseconds\n", Timeout_ttl / (Timeout_cnt == 0? 1:Timeout_cnt));
printf(" NSamples: %d. Valid: %s\n", Timeout_cnt, (Timeout_cnt == 0)? "NO": "yes");
printf("Send Average: %d nanoseconds\n", Send_ttl / (Send_cnt == 0? 1:Send_cnt));
printf(" NSamples: %d. Valid: %s\n", Send_cnt, (Send_cnt == 0)? "NO": "yes");
printf("Player Average: %d nanoseconds\n", Player_ttl / (Player_cnt == 0? 1:Player_cnt));
printf(" NSamples: %d. Valid: %s\n", Player_cnt, (Player_cnt == 0)? "NO": "yes");
}