SW Profiler tool

SW Profiler Tool

As a embedded developer I’m always missing some tools for measuring min/avg/max timing on some functions. As well as I need to know how many calls this or that function has had …

So to coop with this – and because some system doing this available are quite costly I started on this system.

Initially – and as it is right now – it can measure timing. It has proven it efficiency and show values that have saved a few projects … very valuable when tracing timing issues, memory usage etc (in real life @targets)

Near future will be adding memory usage, data access …

  • Time measurement
  • Memory Measurement  (to come)
  • Data access profiles
  • I/O read/write to various devices (driver interception)
  • General hits or statistics: like number of calls, execution time, time-between-calls and a lot more …

 

Statistics are returned - like

  • number of start/stop
  • minimum time
  • maximum time
  • avg time

 

Article Images: stopwatchoverview.png

 

Downloads

Version

Description

Download

1.0

Version able to run in Cygwin

1.0

1.1

Updated with wrap-around, better print out and a few things more...

1.1

1.3

Version for Visual Studio - single file impl
(gcc solution not tested)

 

 

 

 

 

 

 

 

The one supplied here holds a small demo, where two tasks run's through some loops - which we then measures on!

The 1.0 version was initially made for embedded development - but since my target was out-of-power, I have developed it using Cygwin. A later version will cover the embedded folks ...

 

 

Description:

The basic functionality is to create a stopwatch, and then operate this stopwatch as one pleases through out in the code. This is done using the start and stop functions.

Each time we stop the timing measurement. we checks if the elapsed time is less or greater that min/max.

At the end we have minimum, average and maximum values.

There is no limits on how many timers you can define and use ... (but you might want to change the counter value from byte to int :-)

 

As seen from the source file - I have some of /TODO's ...

 

Setup & making-it-work ?

Well that's easy, download the file, remove the existing main and two test functions. Specify how many stopwatch's you'll be needing ... Well That's more or less it. 
Now U need to specify the source of your system clock (free running counter, timer in mSec or ...) 

Then make xxStart() and xxStop() in your existing code.

Compile ... and your on. Now get to the printout function, and modify it for your platform. Printf's , seriel output, printer stuff or what ever. The lines are there, you just need to direct the output ...

 

<example screen dump here>

john@pc7 /cygdrive/c/cvs/common_utilities/RTOS/Profiler/src
$ ./compile_profile.sh

john@pc7 /cygdrive/c/cvs/common_utilities/RTOS/Profiler/src
$ ./prof.exe
SW Performance measurement $Revision: 1.3 $
Fnc: main()
Fnc: SYS_Profiler_PrintOut()
System Definitions:
Time Now: 0x 4468f0c8 1147728072
WrapAround: -1
Total ID : 5
Fnc: Appl_Profiler_Init()
Fnc: SYS_ProfilerInit()
Fnc: SYS_ProfilerAddSubject() TaskName= Task1 1
Fnc: SYS_ProfilerAddSubject() TaskName= Task2 2
Fnc: SYS_ProfilerAddSubject() TaskName= Task3 3
Fnc: task_number1()
[Fnc: task_number2()
..................................................]
[Fnc: task_number2()
..................................................]
[Fnc: task_number2()
..................................................]
[Fnc: task_number2()
..................................................]
[Fnc: task_number2()
..................................................]
[Fnc: task_number2()
..................................................]
[Fnc: task_number2()
..................................................]
[Fnc: task_number2()
..................................................]
[Fnc: task_number2()
..................................................]
[Fnc: task_number2()
..................................................]
Fnc: SYS_ProfilerRecalcSystem()
Fnc: Appl_Profiler_Closing()
Fnc: SYS_Profiler_PrintOut()
-------------------------------------
Rec/Name/Added/ 1 Task1 1147728072
Min/Avrg/Max/ 0 16 32
Start/Stop/Cnt 1147728072 1147728104 1

Rec/Name/Added/ 2 Task2 1147728072
Min/Avrg/Max/ 0 1 3
Start/Stop/Cnt 1147728101 1147728104 10

Rec/Name/Added/ 3 Task3 1147728072
Min/Avrg/Max/ 0 0 1
Start/Stop/Cnt 1147728101 1147728101 10

Rec/Name/Added/ 4 <empty>
1147728072
Min/Avrg/Max/ 0 0 0
Start/Stop/Cnt 0 0 0

Rec/Name/Added/ 5 <empty>
1147728072
Min/Avrg/Max/ 0 0 0
Start/Stop/Cnt 0 0 0

Total ID : 5

Fnc: SYS_Profiler_PrintOut()
System Record: Start/Stop/Cnt
4468f0c8 1147728104 1
It took 32

-end-

john@pc7 /cygdrive/c/cvs/common_utilities/RTOS/Profiler/src
$

Comments

No Comments have been Posted.

Post Comment

Please Login to Post a Comment.

Articles Panel

  Article Posted By Date Reads
WCET - Worst Case Execution Timings Calculator
Tools
johnk
28-06-2015 19:2912818
Embedded-Tracer-System
Tools
johnk
16-03-2015 18:222015
NuttX - Step-By-Step
Tools
johnk
30-12-2013 17:185590
Tools used
Tools
johnk
27-10-2013 12:133220
List of my robots
My robots
johnk
19-07-2013 08:442933
JoKaBot - Home build from scratch
My robots
johnk
19-07-2013 08:045473
C-Sharp (references and projects)
Oldies
johnk
18-07-2013 19:193335
Home communications
Technology
johnk
18-07-2013 18:233536
Various links
My Collection
johnk
17-07-2013 09:046848
ARM - ARM7/9/11 + Cortex
Technology
johnk
17-07-2013 08:493534
AVR32
Technology
johnk
17-07-2013 08:413623
Raspberry PI
Technology
johnk
17-07-2013 08:369263
Robotics Links
Tools
johnk
17-07-2013 08:367461
Robotics in general
Robotics
johnk
17-07-2013 08:352820
Renesas processors (V850, RL78...)
Technology
johnk
17-07-2013 08:113399

Total Articles: 54 :: Total Article Categories: 16
 

Articles

My Collection (1) My robots (2)
Oldies (5)
Old Projects - very old
Process & Methods (7)
Projects (12) Robotics (1)
Technology (6) Testing (1)
Tools (12) Working on ... (7)
Projects Im currently working on
Render time: 0.08 seconds
701,353 unique visits