-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdurian_repository.c
121 lines (116 loc) · 4.71 KB
/
durian_repository.c
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
#include "durian_repository.h"
void repository_track_task(durian_ctx *ctx, int pid, const char comm[16], int prio, unsigned long long ktime_ns)
{
pipeline_push_command(ctx,
"EVALSHA %s "
"%d "
"%d:comm "
"%d:prio "
"%d:total_cpu_time_ns "
"%d:total_wait_time_ns "
"%d:last_seen_state "
"%d:last_ktime_ns "
"%d:sched_stats_start_time_ns "
"%d:nr_switches "
"%d:nr_wait_switches "
"%s "
"%llu "
"%s "
"%d "
"%d "
"%d",
lua_script_track_task_sha1_hash,
10,
pid, pid, pid, pid, pid, pid, pid, pid, pid, RUNNING_PID_SET,
ktime_ns,
comm,
prio,
pid,
TASK_RUNNING_RQ);
}
void repository_untrack_task(durian_ctx *ctx, int pid, unsigned long long ktime_ns)
{
pipeline_push_command(ctx,
"EVALSHA %s "
"%d "
"%d:comm "
"%d:prio "
"%d:total_cpu_time_ns "
"%d:total_wait_time_ns "
"%d:last_seen_state "
"%d:last_ktime_ns "
"%d:sched_stats_start_time_ns "
"%d:nr_switches "
"%d:nr_wait_switches "
"%s "
"%s "
"%llu "
"%d "
"%d",
lua_script_untrack_task_sha1_hash,
11,
pid, pid, pid, pid, pid, pid, pid, pid, pid, RUNNING_PID_SET, EXPIRED_PID_SET,
ktime_ns,
pid,
__TASK_STOPPED);
}
void repository_update_stats_task_enters_cpu(durian_ctx *ctx, int pid, const char comm[16], int prio, unsigned long long ktime_ns)
{
pipeline_push_command(ctx,
"EVALSHA %s "
"%d "
"%d:last_ktime_ns "
"%d:last_seen_state "
"%d:total_cpu_time_ns "
"%d:total_wait_time_ns "
"%d:comm "
"%d:prio "
"%d:sched_stats_start_time_ns "
"%d:nr_switches "
"%d:nr_wait_switches "
"%s "
"%llu "
"%s "
"%d "
"%d "
"%d ",
lua_script_update_stats_task_enters_cpu_sha1_hash,
10,
pid, pid, pid, pid, pid, pid, pid, pid, pid, RUNNING_PID_SET,
ktime_ns,
comm,
prio,
pid,
TASK_RUNNING_RQ);
}
void repository_update_stats_task_exits_cpu(durian_ctx *ctx, int pid, unsigned long long ktime_ns, int trace_sched_switch_state)
{
pipeline_push_command(ctx,
"EVALSHA %s "
"%d "
"%d:last_ktime_ns "
"%d:last_seen_state "
"%d:total_cpu_time_ns "
"%d:nr_wait_switches "
"%llu "
"%d",
lua_script_update_stats_task_exits_cpu_sha1_hash,
4,
pid, pid, pid, pid,
ktime_ns,
trace_sched_switch_state);
}
void repository_update_stats_task_wait_ends(durian_ctx *ctx, int pid, unsigned long long ktime_ns)
{
pipeline_push_command(ctx,
"EVALSHA %s "
"%d "
"%d:last_ktime_ns "
"%d:last_seen_state "
"%d:total_wait_time_ns "
"%llu",
lua_script_update_stats_task_wait_ends_sha1_hash,
3,
pid, pid, pid,
ktime_ns);
}