From e771e7e1e081a1b5afd983fb6b9b4160bde3c135 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Mon, 22 Mar 2021 09:04:24 -0400 Subject: [PATCH] feat: add memory to sandbox log --- .../licenseplate/by_plate_count/.gitignore | 1 + .../licenseplate/by_plate_count/log.csv | 16 ---------------- runtime/include/sandbox.h | 15 ++++++++++----- runtime/src/main.c | 4 ++-- 4 files changed, 13 insertions(+), 23 deletions(-) delete mode 100644 runtime/experiments/applications/licenseplate/by_plate_count/log.csv diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/.gitignore b/runtime/experiments/applications/licenseplate/by_plate_count/.gitignore index 34cb46d..ab65fff 100644 --- a/runtime/experiments/applications/licenseplate/by_plate_count/.gitignore +++ b/runtime/experiments/applications/licenseplate/by_plate_count/.gitignore @@ -1 +1,2 @@ flower.jpg +log.csv diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/log.csv b/runtime/experiments/applications/licenseplate/by_plate_count/log.csv deleted file mode 100644 index 47925cd..0000000 --- a/runtime/experiments/applications/licenseplate/by_plate_count/log.csv +++ /dev/null @@ -1,16 +0,0 @@ -id,function,state,deadline,actual,queued,initializing,runnable,running,blocked,returned -0,lpd1():10000,Complete,50000,1045750,15,0,26,46516,999192,510 -1,lpd1():10000,Complete,50000,1077003,4,0,23,76956,1000018,457 -2,lpd1():10000,Complete,50000,1122135,4,0,27,121007,1001095,1194 -3,lpd1():10000,Complete,50000,1066601,4,0,14,65484,1001097,408 -4,lpd1():10000,Complete,50000,1063433,4,0,25,62343,1001061,525 -5,lpd2():10001,Complete,50000,1073007,4,0,23,71896,1001082,403 -6,lpd2():10001,Complete,50000,1091218,4,0,15,90076,1001122,510 -7,lpd2():10001,Complete,50000,1080843,5,0,23,79721,1001093,493 -8,lpd2():10001,Complete,50000,1084299,4,0,22,83160,1001111,503 -9,lpd2():10001,Complete,50000,1094432,4,0,82,93309,1001036,715 -10,lpd4():10002,Complete,50000,1076785,5,0,26,75576,1001177,434 -11,lpd4():10002,Complete,50000,1098984,4,0,16,98936,1000026,561 -12,lpd4():10002,Complete,50000,1083239,4,0,17,83188,1000029,493 -13,lpd4():10002,Complete,50000,1095906,4,0,26,94940,1000935,564 -14,lpd4():10002,Complete,50000,1087100,7,0,19,86005,1001067,514 diff --git a/runtime/include/sandbox.h b/runtime/include/sandbox.h index bd4f620..b44a2e2 100644 --- a/runtime/include/sandbox.h +++ b/runtime/include/sandbox.h @@ -32,9 +32,9 @@ struct sandbox { uint32_t sandbox_size; /* The struct plus enough buffer to hold the request or response (sized off largest) */ - void * linear_memory_start; /* after sandbox struct */ - uint32_t linear_memory_size; /* from after sandbox struct */ - uint64_t linear_memory_max_size; + void * linear_memory_start; /* after sandbox struct */ + uint32_t linear_memory_size; /* from after sandbox struct */ + uint64_t linear_memory_max_size; /* 4GB */ void * stack_start; uint32_t stack_size; @@ -245,10 +245,15 @@ sandbox_print_perf(struct sandbox *sandbox) uint32_t blocked_us = sandbox->blocked_duration / runtime_processor_speed_MHz; uint32_t returned_us = sandbox->returned_duration / runtime_processor_speed_MHz; - fprintf(runtime_sandbox_perf_log, "%lu,%s():%d,%s,%u,%u,%u,%u,%u,%u,%u,%u\n", sandbox->id, + /* + * Assumption: A sandbox is never able to free pages. If linear memory management + * becomes more intelligent, then peak linear memory size needs to be tracked + * seperately from current linear memory size. + */ + fprintf(runtime_sandbox_perf_log, "%lu,%s():%d,%s,%u,%u,%u,%u,%u,%u,%u,%u,%u\n", sandbox->id, sandbox->module->name, sandbox->module->port, sandbox_state_stringify(sandbox->state), sandbox->module->relative_deadline_us, total_time_us, queued_us, initializing_us, runnable_us, - running_us, blocked_us, returned_us); + running_us, blocked_us, returned_us, sandbox->linear_memory_size); } static inline void diff --git a/runtime/src/main.c b/runtime/src/main.c index a28eeab..1a3290f 100644 --- a/runtime/src/main.c +++ b/runtime/src/main.c @@ -213,8 +213,8 @@ runtime_configure() printf("Logging Sandbox Performance to: %s\n", runtime_sandbox_perf_log_path); runtime_sandbox_perf_log = fopen(runtime_sandbox_perf_log_path, "w"); if (runtime_sandbox_perf_log == NULL) { perror("sandbox perf log"); } - fprintf(runtime_sandbox_perf_log, - "id,function,state,deadline,actual,queued,initializing,runnable,running,blocked,returned\n"); + fprintf(runtime_sandbox_perf_log, "id,function,state,deadline,actual,queued,initializing,runnable," + "running,blocked,returned,memory\n"); } }