Graph latency can be defined as the time spent from receiving the
first input data to producing the first output data. The following example shows how
to profile graph throughput using the event API. In the example, gr
is the application graph object, plio_out
is the PLIO object
connecting to the graph output port, and gmio_in
is the GMIO object
connecting to the graph input port.
gr.init();
event::handle handle = event::start_profiling(gmio_in, plio_out, event::io_stream_start_difference_cycles);
if(handle==event::invalid_handle){
printf("ERROR:Invalid handle. Only two performance counter in a AIE-PL interface tile\n");
return 1;
}
gr.run(8);
gr.wait();
long long latency_in_cycles = event::read_profiling(handle);
event::stop_profiling(handle);
In the example, after graph is initialized, event::start_profiling
is called to configure the AI Engine to count the clock cycles from the
stream start event of the input I/O port to the stream start event of the output I/O
port. The first and the second argument in event::start_profiling
can be GMIO or PLIO ports, representing the
input and the output I/O port respectively. In this example, gmio_in
is the input I/O port and plio_out
is the output I/O port. The third argument is set to event::io_stream_start_difference_cycles
enumeration.
The counter value simply indicates the graph latency in cycles.