diff --git a/lib/aos/aos_urpc.c b/lib/aos/aos_urpc.c index 011e48b..0dcfa3d 100644 --- a/lib/aos/aos_urpc.c +++ b/lib/aos/aos_urpc.c @@ -23,6 +23,10 @@ extern coreid_t my_core_id; extern rpc_handler_t rpc_handlers[RPC_MTYPE_COUNT]; +#ifdef PERFORMANCE_ENABLED +struct performance_context p; +#endif + errval_t do_aos_urpc( struct aos_urpc *rpc, uintptr_t msg_type, struct capref arg_cap, size_t arg_size, uintptr_t arg0, uintptr_t arg1, @@ -144,6 +148,12 @@ static void urpc_server_handler(void *arg) { // tell the other side that we are done urpc->meta->call_in_progress = false; +#ifdef PERFORMANCE_ENABLED + if(msg_type == RPC_MTYPE_NOP) { + perf_add_now(&p, "done"); + } +#endif + // Unblock the URPC thread thread_sem_post(&urpc->sem); } @@ -168,7 +178,6 @@ errval_t aos_urpc_get_bootinfo(struct aos_urpc * rpc, struct bootinfo_serialized return SYS_ERR_OK; } -struct performance_context p; int urpc_server(void *arg) { struct aos_urpc_server *urpc = arg; struct waitset *default_ws = get_default_waitset(); @@ -201,7 +210,9 @@ int urpc_server(void *arg) { waitset_chan_trigger_closure(default_ws, &chan, MKCLOSURE(urpc_server_handler, urpc)); #ifdef PERFORMANCE_ENABLED - perf_add_now(&p, "triggered_closure"); + if(type_nop) { + perf_add_now(&p, "triggered_closure"); + } #endif // wait until the rpc is handled @@ -209,7 +220,6 @@ int urpc_server(void *arg) { #ifdef PERFORMANCE_ENABLED if(type_nop) { - perf_add_now(&p, "done"); perf_print(&p); } #endif diff --git a/lib/aos/performance.c b/lib/aos/performance.c index 5a030de..9eb0e8c 100644 --- a/lib/aos/performance.c +++ b/lib/aos/performance.c @@ -11,6 +11,7 @@ void perf_init(struct performance_context *c, char *name) { inline void perf_add_measurement(struct performance_context *c, char *tag, systime_t timestamp) { + assert(c->count < PERFORMANCE_MEASUREMENT_COUNT_MAX); c->measurements[c->count].tag = tag; c->measurements[c->count].timestamp = timestamp; c->count++; diff --git a/performance/performance_evaluation.py b/performance/performance_evaluation.py index e3f2daf..767c8ca 100644 --- a/performance/performance_evaluation.py +++ b/performance/performance_evaluation.py @@ -39,12 +39,15 @@ def read_data(file): def build_dataseries(measurements, start_tag, end_tag): datapoints = [] + measurements = list(filter(lambda m: start_tag == m["tag"] or end_tag == m["tag"], measurements)) started_at = None for m in measurements: if started_at is None: if m["tag"] == start_tag: started_at = m["timestamp"] + elif m["tag"] == end_tag: + print(f"[ERROR] Got end tag without start {end_tag}") else: if m["tag"] == end_tag: datapoints.append(m["timestamp"] - started_at) @@ -85,12 +88,11 @@ def main(): # create plots for data series for key in dataset: d = dataset[key] - d.sort() p.clf() p.title(key) p.xlabel("datapoint index") p.ylabel("duration (cycles)") - p.scatter(range(len(d)), d) + p.plot(range(len(d)), d) p.savefig(os.path.join(out_dir, f"{key}.jpg")) p.clf() diff --git a/performance/plots/archive/urpc_empty_loop/client_to_server.jpg b/performance/plots/archive/urpc_empty_loop/client_to_server.jpg index 566a947..c5ecc16 100644 Binary files a/performance/plots/archive/urpc_empty_loop/client_to_server.jpg and b/performance/plots/archive/urpc_empty_loop/client_to_server.jpg differ diff --git a/performance/plots/archive/urpc_empty_loop/metrics.jpg b/performance/plots/archive/urpc_empty_loop/metrics.jpg index 93f91c9..773bd18 100644 Binary files a/performance/plots/archive/urpc_empty_loop/metrics.jpg and b/performance/plots/archive/urpc_empty_loop/metrics.jpg differ diff --git a/performance/plots/archive/urpc_empty_loop/performance.jpg b/performance/plots/archive/urpc_empty_loop/performance.jpg index bd08db6..8154f42 100644 Binary files a/performance/plots/archive/urpc_empty_loop/performance.jpg and b/performance/plots/archive/urpc_empty_loop/performance.jpg differ diff --git a/performance/plots/archive/urpc_empty_loop/server_completed_task.jpg b/performance/plots/archive/urpc_empty_loop/server_completed_task.jpg index 83f85ff..2665361 100644 Binary files a/performance/plots/archive/urpc_empty_loop/server_completed_task.jpg and b/performance/plots/archive/urpc_empty_loop/server_completed_task.jpg differ diff --git a/performance/plots/archive/urpc_empty_loop/server_schedule_task.jpg b/performance/plots/archive/urpc_empty_loop/server_schedule_task.jpg index 10b5d3b..8c018aa 100644 Binary files a/performance/plots/archive/urpc_empty_loop/server_schedule_task.jpg and b/performance/plots/archive/urpc_empty_loop/server_schedule_task.jpg differ diff --git a/performance/plots/archive/urpc_empty_loop/server_to_client.jpg b/performance/plots/archive/urpc_empty_loop/server_to_client.jpg index ad6a30d..e018775 100644 Binary files a/performance/plots/archive/urpc_empty_loop/server_to_client.jpg and b/performance/plots/archive/urpc_empty_loop/server_to_client.jpg differ diff --git a/performance/plots/archive/urpc_yield_loop/client_to_server.jpg b/performance/plots/archive/urpc_yield_loop/client_to_server.jpg index 4f96316..0190817 100644 Binary files a/performance/plots/archive/urpc_yield_loop/client_to_server.jpg and b/performance/plots/archive/urpc_yield_loop/client_to_server.jpg differ diff --git a/performance/plots/archive/urpc_yield_loop/metrics.jpg b/performance/plots/archive/urpc_yield_loop/metrics.jpg index 40392b5..3293314 100644 Binary files a/performance/plots/archive/urpc_yield_loop/metrics.jpg and b/performance/plots/archive/urpc_yield_loop/metrics.jpg differ diff --git a/performance/plots/archive/urpc_yield_loop/performance.jpg b/performance/plots/archive/urpc_yield_loop/performance.jpg index aef77cc..103f8d0 100644 Binary files a/performance/plots/archive/urpc_yield_loop/performance.jpg and b/performance/plots/archive/urpc_yield_loop/performance.jpg differ diff --git a/performance/plots/archive/urpc_yield_loop/server_completed_task.jpg b/performance/plots/archive/urpc_yield_loop/server_completed_task.jpg index 1c69a33..0caf044 100644 Binary files a/performance/plots/archive/urpc_yield_loop/server_completed_task.jpg and b/performance/plots/archive/urpc_yield_loop/server_completed_task.jpg differ diff --git a/performance/plots/archive/urpc_yield_loop/server_schedule_task.jpg b/performance/plots/archive/urpc_yield_loop/server_schedule_task.jpg index 673516f..49dc3f7 100644 Binary files a/performance/plots/archive/urpc_yield_loop/server_schedule_task.jpg and b/performance/plots/archive/urpc_yield_loop/server_schedule_task.jpg differ diff --git a/performance/plots/archive/urpc_yield_loop/server_to_client.jpg b/performance/plots/archive/urpc_yield_loop/server_to_client.jpg index a15117c..ac3297d 100644 Binary files a/performance/plots/archive/urpc_yield_loop/server_to_client.jpg and b/performance/plots/archive/urpc_yield_loop/server_to_client.jpg differ diff --git a/usr/init/main.c b/usr/init/main.c index 76b7f62..43bccd3 100644 --- a/usr/init/main.c +++ b/usr/init/main.c @@ -253,20 +253,22 @@ app_main(int argc, char *argv[]) { struct performance_context p; // measure performance measurement performance - for(size_t i = 0; i < 1000; ++i) { + for(size_t i = 0; i < 100; ++i) { perf_init(&p, "aos_performance"); perf_add_now(&p, "start"); perf_add_now(&p, "done"); perf_print(&p); + barrelfish_usleep(10000); } // measure URPC performance - for(size_t i = 0; i < 1000; ++i) { + for(size_t i = 0; i < 100; ++i) { perf_init(&p, "aos_urpc_nop"); perf_add_now(&p, "start"); do_aos_urpc(&urpc_to_bsp, RPC_MTYPE_NOP, NULL_CAP, 0, 0, 0, NULL, NULL, NULL, NULL); perf_add_now(&p, "done"); perf_print(&p); + barrelfish_usleep(10000); } #endif