summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-04-22 11:46:10 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-04-28 09:26:19 +0200
commit8365ad1347abe67ce28f650775a14152bd127b8d (patch)
treefc300d3af8b76a5bfa73a8777ddc07c1414399c3
parentsparc: Add _CPU_Get_current_per_CPU_control() (diff)
downloadrtems-8365ad1347abe67ce28f650775a14152bd127b8d.tar.bz2
sapi: Add arithmetic means to XML profiling report
-rw-r--r--cpukit/sapi/src/profilingreportxml.c71
1 files 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,
- "<ThreadDispatchDisabledCount>%" PRIu64 "</ThreadDispatchDisabledCount>\n",
- per_cpu->thread_dispatch_disabled_count
+ "<MeanThreadDispatchDisabledTime unit=\"ns\">%" PRIu64
+ "</MeanThreadDispatchDisabledTime>\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,
- "<MaxInterruptTime unit=\"ns\">%" PRIu32
- "</MaxInterruptTime>\n",
- per_cpu->max_interrupt_time
+ "<ThreadDispatchDisabledCount>%" PRIu64 "</ThreadDispatchDisabledCount>\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,
- "<InterruptCount>%" PRIu64 "</InterruptCount>\n",
- per_cpu->interrupt_count
+ "<MaxInterruptTime unit=\"ns\">%" PRIu32
+ "</MaxInterruptTime>\n",
+ per_cpu->max_interrupt_time
+ );
+ update_retval(ctx, rv);
+
+ indent(ctx, 2);
+ rv = (*printf_func)(
+ printf_arg,
+ "<MeanInterruptTime unit=\"ns\">%" PRIu64
+ "</MeanInterruptTime>\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,
+ "<InterruptCount>%" PRIu64 "</InterruptCount>\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,
- "<UsageCount>%" PRIu64 "</UsageCount>\n",
- smp_lock->usage_count
+ "<MeanAcquireTime unit=\"ns\">%" PRIu64
+ "</MeanAcquireTime>\n",
+ arithmetic_mean(
+ smp_lock->total_acquire_time,
+ smp_lock->usage_count
+ )
+ );
+ update_retval(ctx, rv);
+
+ indent(ctx, 2);
+ rv = (*printf_func)(
+ printf_arg,
+ "<MeanSectionTime unit=\"ns\">%" PRIu64
+ "</MeanSectionTime>\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,
+ "<UsageCount>%" PRIu64 "</UsageCount>\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)(