Skip to content

Commit a410200

Browse files
authored
Merge pull request #2799 from devnexen/scx_qmap_sleep
scx_qmap: making data update time flexible.
2 parents 3b3f964 + ef81707 commit a410200

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

scheds/c/scx_qmap.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@ const char help_fmt[] =
3333
" -d PID Disallow a process from switching into SCHED_EXT (-1 for self)\n"
3434
" -D LEN Set scx_exit_info.dump buffer length\n"
3535
" -S Suppress qmap-specific debug dump\n"
36+
" -i INTERVAL Override the sleep interval (default: 1)\n"
3637
" -p Switch only tasks on SCHED_EXT policy instead of all\n"
3738
" -v Print libbpf debug messages\n"
3839
" -h Display this help and exit\n";
3940

4041
static bool verbose;
4142
static volatile int exit_req;
43+
static u32 sleep_time = 1;
4244

4345
static int libbpf_print_fn(enum libbpf_print_level level, const char *format, va_list args)
4446
{
@@ -66,7 +68,7 @@ int main(int argc, char **argv)
6668

6769
skel->rodata->slice_ns = __COMPAT_ENUM_OR_ZERO("scx_public_consts", "SCX_SLICE_DFL");
6870

69-
while ((opt = getopt(argc, argv, "s:e:t:T:l:b:PHd:D:Spvh")) != -1) {
71+
while ((opt = getopt(argc, argv, "s:e:t:T:l:b:PHd:D:i:Spvh")) != -1) {
7072
switch (opt) {
7173
case 's':
7274
skel->rodata->slice_ns = strtoull(optarg, NULL, 0) * 1000;
@@ -109,6 +111,11 @@ int main(int argc, char **argv)
109111
case 'v':
110112
verbose = true;
111113
break;
114+
case 'i':
115+
sleep_time = strtoul(optarg, NULL, 0);
116+
if (!sleep_time)
117+
sleep_time = 1;
118+
break;
112119
default:
113120
fprintf(stderr, help_fmt, basename(argv[0]));
114121
return opt != 'h';
@@ -141,7 +148,7 @@ int main(int argc, char **argv)
141148
skel->bss->cpuperf_target_avg,
142149
skel->bss->cpuperf_target_max);
143150
fflush(stdout);
144-
sleep(1);
151+
sleep(sleep_time);
145152
}
146153

147154
bpf_link__destroy(link);

0 commit comments

Comments
 (0)