Skip to content

Commit

Permalink
libsel4utils: use proper types for printing
Browse files Browse the repository at this point in the history
Signed-off-by: Axel Heider <axelheider@gmx.de>
  • Loading branch information
axel-h committed Feb 22, 2024
1 parent 1c1e606 commit 0b74819
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
5 changes: 3 additions & 2 deletions libsel4utils/include/sel4utils/benchmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ static inline void seL4_BenchmarkTraceDumpFullLog(benchmark_tracepoint_log_entry

while ((index * sizeof(benchmark_tracepoint_log_entry_t)) < logSize) {
if (logBuffer[index].duration != 0) {
fprintf(fd, "tracepoint id = %u \tduration = %u\n", logBuffer[index].id, logBuffer[index].duration);
fprintf(fd, "tracepoint id = %"SEL4_PRIu_word" \tduration = %"SEL4_PRIu_word"\n",
logBuffer[index].id, logBuffer[index].duration);
}
index++;
}

fprintf(fd, "Dumped entire log, size %" PRIu32 "\n", index);
fprintf(fd, "Dumped entire log, size %"SEL4_PRIu_word"\n", index);
}
#endif /* CONFIG_BENCHMARK_TRACEPOINTS */
40 changes: 20 additions & 20 deletions libsel4utils/include/sel4utils/benchmark_track.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ static inline void seL4_BenchmarkTrackDumpSummary(benchmark_track_kernel_entry_t
index++;
}

fprintf(fd, "Number of system call invocations %d\n", syscall_entries);
fprintf(fd, "Number of interrupt invocations %d\n", interrupt_entries);
fprintf(fd, "Number of user-level faults %d\n", userlevelfault_entries);
fprintf(fd, "Number of VM faults %d\n", vmfault_entries);
fprintf(fd, "Number of system call invocations: %"SEL4_PRIu_word"\n", syscall_entries);
fprintf(fd, "Number of interrupt invocations: %"SEL4_PRIu_word"\n", interrupt_entries);
fprintf(fd, "Number of user-level faults: %"SEL4_PRIu_word"\n", userlevelfault_entries);
fprintf(fd, "Number of VM faults: %"SEL4_PRIu_word"\n", vmfault_entries);
}

/* Print out logged system call invocations */
Expand All @@ -54,22 +54,22 @@ static inline void seL4_BenchmarkTrackDumpFullSyscallLog(benchmark_track_kernel_
/* Get details of each system call invocation */
fprintf(fd,
"-----------------------------------------------------------------------------------------------------------------------------\n");
fprintf(fd, "| %-15s| %-15s| %-15s| %-15s| %-15s| %-15s| %-15s|\n",
"Log ID", "System Call ID", "Start Time", "Duration", "Capability Type",
"Invocation Tag", "Fastpath?");
fprintf(fd, " %-10s | %-7s | %-20s | %-10s | %-3s | %-7s| %-8s\n",
"Log ID", "SysCall", "Start Time", "Duration", "Cap",
"Tag", "Fastpath?");
fprintf(fd,
"-----------------------------------------------------------------------------------------------------------------------------\n");

while (logBuffer[index].start_time != 0 && (index * sizeof(benchmark_track_kernel_entry_t)) < logSize) {
if (logBuffer[index].entry.path == Entry_Syscall) {
fprintf(fd, "| %-15d| %-15d| %-15llu| %-15d| %-15d| %-15d| %-15d|\n",
fprintf(fd, " %-10"SEL4_PRIu_word" | %-7u | %-20"PRIu64" | %-10u | %-3u | %-7u | %-9s\n",
index,
logBuffer[index].entry.syscall_no,
(uint64_t) logBuffer[index].start_time,
logBuffer[index].duration,
logBuffer[index].entry.cap_type,
logBuffer[index].entry.invocation_tag,
logBuffer[index].entry.is_fastpath);
(unsigned int)logBuffer[index].entry.syscall_no, /* 4 bit */
logBuffer[index].start_time, /* 64 bit */
logBuffer[index].duration, /* 32 bit */
(unsigned int)logBuffer[index].entry.cap_type, /* 5 bit */
(unsigned int)logBuffer[index].entry.invocation_tag, /* 19 bit */
logBuffer[index].entry.is_fastpath ? "yes" : "no");
}
index++;
}
Expand All @@ -84,18 +84,18 @@ static inline void seL4_BenchmarkTrackDumpFullInterruptLog(benchmark_track_kerne
/* Get details of each invocation */
fprintf(fd,
"-----------------------------------------------------------------------------------------------------------------------------\n");
fprintf(fd, "| %-15s| %-15s| %-15s| %-15s|\n", "Log ID", "IRQ", "Start Time",
"Duration");
fprintf(fd, " %-10s | %-8s | %-20s | %-10s \n",
"Log ID", "IRQ", "Start Time", "Duration");
fprintf(fd,
"-----------------------------------------------------------------------------------------------------------------------------\n");

while (logBuffer[index].start_time != 0 && (index * sizeof(benchmark_track_kernel_entry_t)) < logSize) {
if (logBuffer[index].entry.path == Entry_Interrupt) {
fprintf(fd, "| %-15d| %-15d| %-15llu| %-15d|\n", \
fprintf(fd, " %-10"SEL4_PRIu_word" | %-8u | %-20"PRIu64" | %-10u\n", \
index,
logBuffer[index].entry.word,
logBuffer[index].start_time,
logBuffer[index].duration);
(unsigned int)logBuffer[index].entry.word, /* 26 bits */
logBuffer[index].start_time, /* 64 bit */
logBuffer[index].duration); /* 32 bit */
}
index++;
}
Expand Down

0 comments on commit 0b74819

Please sign in to comment.