Merge pull request #21 from arighi/misc-fixes

This commit is contained in:
David Vernet 2023-12-09 09:33:09 -06:00 committed by GitHub
commit ab1d894fd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 20 additions and 17 deletions

View File

@ -6,6 +6,7 @@
*/
#include <stdio.h>
#include <unistd.h>
#include <inttypes.h>
#include <signal.h>
#include <libgen.h>
#include <bpf/bpf.h>
@ -143,7 +144,7 @@ static void print_active_nests(const struct scx_nest *skel)
total++;
}
}
printf("%-9s(%2lu): | %s |\n", mask_str, total, cpus);
printf("%-9s(%2" PRIu64 "): | %s |\n", mask_str, total, cpus);
}
}
@ -209,7 +210,7 @@ int main(int argc, char **argv)
print_stat_grp(nest_stat->group);
last_grp = nest_stat->group;
}
printf("%s=%lu\n", nest_stat->label, stats[nest_stat->idx]);
printf("%s=%" PRIu64 "\n", nest_stat->label, stats[nest_stat->idx]);
}
printf("\n");
print_active_nests(skel);

View File

@ -8,6 +8,7 @@
#include <sched.h>
#include <stdio.h>
#include <unistd.h>
#include <inttypes.h>
#include <signal.h>
#include <libgen.h>
#include <bpf/bpf.h>
@ -103,17 +104,17 @@ int main(int argc, char **argv)
while (!exit_req && !uei_exited(&skel->bss->uei)) {
printf("[SEQ %llu]\n", seq++);
printf("total :%10lu local:%10lu queued:%10lu lost:%10lu\n",
printf("total :%10" PRIu64 " local:%10" PRIu64 " queued:%10" PRIu64 " lost:%10" PRIu64 "\n",
skel->bss->nr_total,
skel->bss->nr_locals,
skel->bss->nr_queued,
skel->bss->nr_lost_pids);
printf("timer :%10lu dispatch:%10lu mismatch:%10lu retry:%10lu\n",
printf("timer :%10" PRIu64 " dispatch:%10" PRIu64 " mismatch:%10" PRIu64 " retry:%10" PRIu64 "\n",
skel->bss->nr_timers,
skel->bss->nr_dispatches,
skel->bss->nr_mismatches,
skel->bss->nr_retries);
printf("overflow:%10lu\n",
printf("overflow:%10" PRIu64 "\n",
skel->bss->nr_overflows);
fflush(stdout);
sleep(1);

View File

@ -123,7 +123,7 @@ struct {
} task_ctx SEC(".maps");
/* gets inc'd on weight tree changes to expire the cached hweights */
unsigned long hweight_gen = 1;
u64 hweight_gen = 1;
static u64 div_round_up(u64 dividend, u64 divisor)
{

View File

@ -9,6 +9,7 @@
#include <unistd.h>
#include <libgen.h>
#include <limits.h>
#include <inttypes.h>
#include <fcntl.h>
#include <time.h>
#include <bpf/bpf.h>
@ -183,7 +184,7 @@ int main(int argc, char **argv)
memcpy(last_stats, acc_stats, sizeof(acc_stats));
printf("\n[SEQ %6lu cpu=%5.1lf hweight_gen=%lu]\n",
printf("\n[SEQ %6lu cpu=%5.1lf hweight_gen=%" PRIu64 "]\n",
seq++, cpu_util * 100.0, skel->data->hweight_gen);
printf(" act:%6llu deact:%6llu local:%6llu global:%6llu\n",
stats[FCG_STAT_ACT],

View File

@ -6,6 +6,7 @@
*/
#include <stdio.h>
#include <unistd.h>
#include <inttypes.h>
#include <signal.h>
#include <libgen.h>
#include <bpf/bpf.h>
@ -142,18 +143,18 @@ int main(int argc, char **argv)
while (!exit_req && !uei_exited(&skel->bss->uei)) {
printf("[SEQ %llu]\n", seq++);
printf(" total:%10lu dispatch:%10lu missing:%10lu\n",
printf(" total:%10" PRIu64 " dispatch:%10" PRIu64 " missing:%10" PRIu64 "\n",
skel->bss->nr_total,
skel->bss->nr_dispatched,
skel->bss->nr_missing);
printf(" kicks:%10lu preemptions:%7lu\n",
printf(" kicks:%10" PRIu64 " preemptions:%7" PRIu64 "\n",
skel->bss->nr_kicks,
skel->bss->nr_preemptions);
printf(" exp:%10lu exp_wait:%10lu exp_empty:%10lu\n",
printf(" exp:%10" PRIu64 " exp_wait:%10" PRIu64 " exp_empty:%10" PRIu64 "\n",
skel->bss->nr_exps,
skel->bss->nr_exp_waits,
skel->bss->nr_exp_empty);
printf("cgnext:%10lu cgcoll:%10lu cgempty:%10lu\n",
printf("cgnext:%10" PRIu64 " cgcoll:%10" PRIu64 " cgempty:%10" PRIu64 "\n",
skel->bss->nr_cgrp_next,
skel->bss->nr_cgrp_coll,
skel->bss->nr_cgrp_empty);

View File

@ -95,8 +95,8 @@ struct {
} dispatch_idx_cnt SEC(".maps");
/* Statistics */
unsigned long nr_enqueued, nr_dispatched, nr_reenqueued, nr_dequeued;
unsigned long nr_core_sched_execed;
u64 nr_enqueued, nr_dispatched, nr_reenqueued, nr_dequeued;
u64 nr_core_sched_execed;
s32 BPF_STRUCT_OPS(qmap_select_cpu, struct task_struct *p,
s32 prev_cpu, u64 wake_flags)

View File

@ -7,6 +7,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <inttypes.h>
#include <signal.h>
#include <libgen.h>
#include <bpf/bpf.h>
@ -90,7 +91,7 @@ int main(int argc, char **argv)
long nr_enqueued = skel->bss->nr_enqueued;
long nr_dispatched = skel->bss->nr_dispatched;
printf("enq=%lu, dsp=%lu, delta=%ld, reenq=%lu, deq=%lu, core=%lu\n",
printf("enq=%lu, dsp=%lu, delta=%ld, reenq=%" PRIu64 ", deq=%" PRIu64 ", core=%" PRIu64 "\n",
nr_enqueued, nr_dispatched, nr_enqueued - nr_dispatched,
skel->bss->nr_reenqueued, skel->bss->nr_dequeued,
skel->bss->nr_core_sched_execed);

View File

@ -20,7 +20,6 @@
* Copyright (c) 2022 Tejun Heo <tj@kernel.org>
* Copyright (c) 2022 David Vernet <dvernet@meta.com>
*/
#include <string.h>
#include <scx/common.bpf.h>
#include "scx_userland.h"
@ -146,9 +145,8 @@ static void dispatch_user_scheduler(void)
static void enqueue_task_in_user_space(struct task_struct *p, u64 enq_flags)
{
struct scx_userland_enqueued_task task;
struct scx_userland_enqueued_task task = {};
memset(&task, 0, sizeof(task));
task.pid = p->pid;
task.sum_exec_runtime = p->se.sum_exec_runtime;
task.weight = p->scx.weight;