From 8365ad1347abe67ce28f650775a14152bd127b8d Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 22 Apr 2014 11:46:10 +0200 Subject: sapi: Add arithmetic means to XML profiling report --- cpukit/sapi/src/profilingreportxml.c | 71 +++++++++++++++++++++++++++++++----- 1 file changed, 62 insertions(+), 9 deletions(-) diff --git a/cpukit/sapi/src/profilingreportxml.c b/cpukit/sapi/src/profilingreportxml.c index d9c50b5f1d..777d1f1d52 100644 --- a/cpukit/sapi/src/profilingreportxml.c +++ b/cpukit/sapi/src/profilingreportxml.c @@ -49,6 +49,11 @@ static void indent(context *ctx, uint32_t indentation_level) } } +static uint64_t arithmetic_mean(uint64_t total, uint64_t count) +{ + return count != 0 ? total / count : 0; +} + static void report_per_cpu(context *ctx, const rtems_profiling_per_cpu *per_cpu) { rtems_profiling_printf printf_func = ctx->printf_func; @@ -75,8 +80,12 @@ static void report_per_cpu(context *ctx, const rtems_profiling_per_cpu *per_cpu) indent(ctx, 2); rv = (*printf_func)( printf_arg, - "%" PRIu64 "\n", - per_cpu->thread_dispatch_disabled_count + "%" PRIu64 + "\n", + arithmetic_mean( + per_cpu->total_thread_dispatch_disabled_time, + per_cpu->thread_dispatch_disabled_count + ) ); update_retval(ctx, rv); @@ -92,9 +101,8 @@ static void report_per_cpu(context *ctx, const rtems_profiling_per_cpu *per_cpu) indent(ctx, 2); rv = (*printf_func)( printf_arg, - "%" PRIu32 - "\n", - per_cpu->max_interrupt_time + "%" PRIu64 "\n", + per_cpu->thread_dispatch_disabled_count ); update_retval(ctx, rv); @@ -109,8 +117,21 @@ static void report_per_cpu(context *ctx, const rtems_profiling_per_cpu *per_cpu) indent(ctx, 2); rv = (*printf_func)( printf_arg, - "%" PRIu64 "\n", - per_cpu->interrupt_count + "%" PRIu32 + "\n", + per_cpu->max_interrupt_time + ); + update_retval(ctx, rv); + + indent(ctx, 2); + rv = (*printf_func)( + printf_arg, + "%" PRIu64 + "\n", + arithmetic_mean( + per_cpu->total_interrupt_time, + per_cpu->interrupt_count + ) ); update_retval(ctx, rv); @@ -122,6 +143,14 @@ static void report_per_cpu(context *ctx, const rtems_profiling_per_cpu *per_cpu) ); update_retval(ctx, rv); + indent(ctx, 2); + rv = (*printf_func)( + printf_arg, + "%" PRIu64 "\n", + per_cpu->interrupt_count + ); + update_retval(ctx, rv); + indent(ctx, 1); rv = (*printf_func)( printf_arg, @@ -164,8 +193,24 @@ static void report_smp_lock(context *ctx, const rtems_profiling_smp_lock *smp_lo indent(ctx, 2); rv = (*printf_func)( printf_arg, - "%" PRIu64 "\n", - smp_lock->usage_count + "%" PRIu64 + "\n", + arithmetic_mean( + smp_lock->total_acquire_time, + smp_lock->usage_count + ) + ); + update_retval(ctx, rv); + + indent(ctx, 2); + rv = (*printf_func)( + printf_arg, + "%" PRIu64 + "\n", + arithmetic_mean( + smp_lock->total_section_time, + smp_lock->usage_count + ) ); update_retval(ctx, rv); @@ -185,6 +230,14 @@ static void report_smp_lock(context *ctx, const rtems_profiling_smp_lock *smp_lo ); update_retval(ctx, rv); + indent(ctx, 2); + rv = (*printf_func)( + printf_arg, + "%" PRIu64 "\n", + smp_lock->usage_count + ); + update_retval(ctx, rv); + for (i = 0; i < RTEMS_PROFILING_SMP_LOCK_CONTENTION_COUNTS; ++i) { indent(ctx, 2); rv = (*printf_func)( -- cgit v1.2.3