[rtems commit] sapi: Add arithmetic means to XML profiling report
Sebastian Huber
sebh at rtems.org
Mon Apr 28 08:02:52 UTC 2014
Module: rtems
Branch: master
Commit: 8365ad1347abe67ce28f650775a14152bd127b8d
Changeset: http://git.rtems.org/rtems/commit/?id=8365ad1347abe67ce28f650775a14152bd127b8d
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Tue Apr 22 11:46:10 2014 +0200
sapi: Add arithmetic means to XML profiling report
---
cpukit/sapi/src/profilingreportxml.c | 71 +++++++++++++++++++++++++++++----
1 files changed, 62 insertions(+), 9 deletions(-)
diff --git a/cpukit/sapi/src/profilingreportxml.c b/cpukit/sapi/src/profilingreportxml.c
index d9c50b5..777d1f1 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)(
More information about the vc
mailing list