in GUI Development by
I found a macro EW_PRINT_PERF_COUNTERS can I use this functionality to evaluate the performances?

In addition to fps print (explained in a faw in this site).

There is an example for this functions?

Thank you


1 Answer

0 votes

The Embedded Wizard Graphics Engine integrates a functionality to count and measure the performance of executed drawing operations. These 'performance counters' are useful when you need:

1. Test the integration with your particular target system.

2. Investigate performance problems within complex GUI applications.

To use this functionality you need to rebuilt the entire application (incl. the Embedded Wizard Graphics Engine and the Embedded Wizard Runtime Environment) with the macro EW_PRINT_PERF_COUNTERS defined in your make file or development environment project file (e.g. Microsoft Visual Studio).

This macro 'adds' additional instrumentation code to every graphical operation. This code counts how often the operation is executed and how much time did it spent. All information is collected in internal data storage. This information is only collected - it is not output automatically.

To output the collected performance information you have to explicitly call the function EwPrintPerfCounters(). When called the function prints the collected data directly to the stdout as it is usually the case of the 'C' function printf().

Besides the function EwPrintPerfCounters() you will also work with its counterpart EwResetPerfCounters(). This function discards all collected information preparing the system for a new measure cycle.

Usually you call the functions from the GUI main-loop. For example, if you want to measure all screen updates on the Win32 target system, then adapt in the associated main.c module the invocation of EwUpdateViewer() as demonstrated below:  

/* Refresh the screen, if something has changed and draw its content in
   the viewer window */

When running the Win32 application will output the collected information in a console window. Here you can see which operations have been collected, how often the operations have been executed and how much time did they take:

It is up to you when you start/end the measure. In the above example the measure took place for every screen update producing a lot out console outputs. You can however, start/end the measure explicitly in response to a keyboard or remote control, etc event. Or you can do it only when a the GUI application is in a particular state, e.g. a performance critical GUI component is shown.

Please note:

  • If your target system is not supporting the output with printf() you can adapt the function EwPrint() found in the module ewextrte.c to redirect the output to e.g. a serial port, etc.
  • To work correctly the described functionality requires the target system to provide a high precision timer. Please review the function EwGetPerfCounter() in the module ewextrte.c whether it is really implemented on your particular target system.
  • On Win32 target system the console window doesn't appear automatically. Add the macro EW_OPEN_CONSOLE to your Microsoft Visual Studio project to open the console window.
  • The performance functionality is not available on the JavaScript target system.

For more information see the description inside the file ewrte.h.


Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint