Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: stats_report.h
- Revision:
- 98:f2d7e14c84a1
- Parent:
- 89:448e37ce650a
--- a/stats_report.h Tue Jul 23 12:00:36 2019 +0100
+++ b/stats_report.h Wed Sep 04 12:00:04 2019 +0100
@@ -4,8 +4,9 @@
*/
#ifndef STATS_REPORT_H
-#define STATS_REPORT
+#define STATS_REPORT_H
+#include <inttypes.h>
#include "mbed.h"
/**
@@ -37,19 +38,19 @@
mbed_stats_sys_get(&sys_stats);
printf("=============================== SYSTEM INFO ================================\r\n");
- printf("Mbed OS Version: %ld \r\n", sys_stats.os_version);
- printf("CPU ID: 0x%lx \r\n", sys_stats.cpu_id);
+ printf("Mbed OS Version: %" PRIu32 " \r\n", sys_stats.os_version);
+ printf("CPU ID: 0x%" PRIx32 " \r\n", sys_stats.cpu_id);
printf("Compiler ID: %d \r\n", sys_stats.compiler_id);
- printf("Compiler Version: %ld \r\n", sys_stats.compiler_version);
+ printf("Compiler Version: %" PRIu32 " \r\n", sys_stats.compiler_version);
for (int i = 0; i < MBED_MAX_MEM_REGIONS; i++) {
if (sys_stats.ram_size[i] != 0) {
- printf("RAM%d: Start 0x%lx Size: 0x%lx \r\n", i, sys_stats.ram_start[i], sys_stats.ram_size[i]);
+ printf("RAM%d: Start 0x%" PRIx32 " Size: 0x%" PRIx32 " \r\n", i, sys_stats.ram_start[i], sys_stats.ram_size[i]);
}
}
for (int i = 0; i < MBED_MAX_MEM_REGIONS; i++) {
if (sys_stats.rom_size[i] != 0) {
- printf("ROM%d: Start 0x%lx Size: 0x%lx \r\n", i, sys_stats.rom_start[i], sys_stats.rom_size[i]);
+ printf("ROM%d: Start 0x%" PRIx32 " Size: 0x%" PRIx32 " \r\n", i, sys_stats.rom_start[i], sys_stats.rom_size[i]);
}
}
}
@@ -104,8 +105,8 @@
// Collect and print heap stats
mbed_stats_heap_get(&heap_stats);
- printf("Current heap: %lu\r\n", heap_stats.current_size);
- printf("Max heap size: %lu\r\n", heap_stats.max_size);
+ printf("Current heap: %" PRIu32 "\r\n", heap_stats.current_size);
+ printf("Max heap size: %" PRIu32 "\r\n", heap_stats.max_size);
}
/**
@@ -119,12 +120,12 @@
int count = mbed_stats_thread_get_each(thread_stats, max_thread_count);
for (int i = 0; i < count; i++) {
- printf("ID: 0x%lx \r\n", thread_stats[i].id);
- printf("Name: %s \r\n", thread_stats[i].name);
- printf("State: %ld \r\n", thread_stats[i].state);
- printf("Priority: %ld \r\n", thread_stats[i].priority);
- printf("Stack Size: %ld \r\n", thread_stats[i].stack_size);
- printf("Stack Space: %ld \r\n", thread_stats[i].stack_space);
+ printf("ID: 0x%" PRIx32 " \r\n", thread_stats[i].id);
+ printf("Name: %s \r\n", thread_stats[i].name);
+ printf("State: %" PRIu32 " \r\n", thread_stats[i].state);
+ printf("Priority: %" PRIu32 " \r\n", thread_stats[i].priority);
+ printf("Stack Size: %" PRIu32 " \r\n", thread_stats[i].stack_size);
+ printf("Stack Space: %" PRIu32 " \r\n", thread_stats[i].stack_space);
}
}
};