Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
18 years ago

performance counter core

hi there,

in my previous message, the code i have was too complicated. I wrote a simple routine to test perfomance counter core. I am running the nios 2/cyclone 2 development kit.

/*

* "Hello World" example.

*

* This example prints 'Hello from Nios II' to the STDOUT stream. It runs on

* the Nios II 'standard', 'full_featured', 'fast', and 'low_cost' example

* designs. It runs with or without the MicroC/OS-II RTOS and requires a STDOUT

* device in your system's hardware.

* The memory footprint of this hosted application is ~69 kbytes by default

* using the standard reference design.

*

* For a reduced footprint version of this template, and an explanation of how

* to reduce the memory footprint for a given application, see the

* "small_hello_world" template.

*

*/

# include <stdio.h># include "alt_types.h"# include "system.h"# include "altera_avalon_performance_counter.h" /*Use to measure code performance*/

int main()

{

int count = 0;

PERF_RESET(PERFORMANCE_COUNTER_0_BASE);

PERF_START_MEASURING(PERFORMANCE_COUNTER_0_BASE);

PERF_BEGIN(PERFORMANCE_COUNTER_0_BASE, 1);

count++;

printf("Hello from Nios II!\n");

PERF_END(PERFORMANCE_COUNTER_0_BASE, 1);

PERF_STOP_MEASURING(PERFORMANCE_COUNTER_0_BASE);

perf_print_formatted_report((void*)PERFORMANCE_COUNTER_0_BASE, ALT_CPU_FREQ,2, "total", "rate1");

return 0;

}

I compiled and loaded the program using the nios 2 programmer and I still get the same output

nios2-terminal: Warning: The JTAG cable you are using is not supported for Nios

nios2-terminal: II systems. You may experience intermittent JTAG communication

nios2-terminal: failures with this cable. Please use a USB Blaster revision B

nios2-terminal: cable or another supported cable. Please refer to the file

nios2-terminal: errata.txt included in the Nios II development kit documents

nios2-terminal: directory for more information.

nios2-terminal: connected to hardware target using JTAG UART on cable

nios2-terminal: "USB-Blaster [USB-0]", device 1, instance 0

nios2-terminal: (Use the IDE stop button or Ctrl-C to terminate)

Hello from Nios II!

--Performance Counter Report--

Total Time: 2.17021E+11 seconds (18446744073709551615 clock-cycles)

+---------------+-----+-----------+---------------+-----------+

| Section | % | Time (sec)| Time (clocks)|Occurrences|

+---------------+-----+-----------+---------------+-----------+

|total | 100|217020518514.23001| -1| 4294967295|

+---------------+-----+-----------+---------------+-----------+

|rate1 | 100|217020518514.23001| -1| 4294967295|

+---------------+-----+-----------+---------------+-----------+

look at how long the total time and -1 in Time. How can this be? anyone has any suggestion?
No RepliesBe the first to reply