Commit 2f4f2de6 authored by Miguel Jimenez Lopez's avatar Miguel Jimenez Lopez

irq-demo: Add a new mode to only use the last timestamp for the stats

parent a2b5e1a7
......@@ -33,7 +33,7 @@ typedef struct _user_args * user_args;
static void demo_irq_process_loop(fmc_dio_device fmc_dev, stats_engine engine,
unsigned int sleep_us);
static void process_timestamps_to_engine(stats_engine engine, struct usr_timestamp *ts,
unsigned int nts);
unsigned int nts, int last_only);
static user_args create_user_arguments(void);
static int parse_user_arguments(int argc, char *argv[], user_args parsed_args);
......
......@@ -167,18 +167,29 @@ static void demo_irq_process_loop(fmc_dio_device fmc_dev, stats_engine engine,
*/
do {
ret = get_utc_ts_from_fmc_dio_device(fmc_dev, TEST_FMC_DIO_CH, &ts, &nts);
process_timestamps_to_engine(engine, ts, nts);
if(!ret) {
// Use only the last TS for stats
process_timestamps_to_engine(engine, ts, nts, 1);
}
usleep(sleep_us);
user_stop = check_user_stop();
} while(!user_stop);
}
static void process_timestamps_to_engine(stats_engine engine, struct usr_timestamp *ts,
unsigned int nts)
unsigned int nts, int last_only)
{
for(int i = 0 ; i < nts ; i++) {
struct usr_timestamp *ts_to_process = ts;
unsigned int nts_to_process = nts;
if(last_only) {
ts_to_process = &ts[nts-1];
nts_to_process = 1;
}
for(int i = 0 ; i < nts_to_process ; i++) {
/* Pass a timestamp to stats engine */
add_usr_timestamp_to_stats_engine(engine, &ts[i]);
add_usr_timestamp_to_stats_engine(engine, &ts_to_process[i]);
/* Compute stats taking into consideration all the timestamps inside the engine */
run_stats_engine(engine, verbose_mode);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment