int main(int argc, char *argv[]) { struct sis33_acq *acqs; int acq_events; sis33_t *dev; parse_args(argc, argv); /* log errors */ sis33_loglevel(3); dev = sis33_open(module_nr); if (dev == NULL) exit(EXIT_FAILURE); /* get a valid event length */ ev_length = sis33_round_event_length(dev, ev_length, SIS33_ROUND_NEAREST); if (acquire) { if (no_wait) { if (sis33_acq(dev, segment_nr, nr_events, ev_length) < 0) exit(EXIT_FAILURE); } else { if (sis33_acq_wait(dev, segment_nr, nr_events, ev_length) < 0) exit(EXIT_FAILURE); } } if (fetch) { acqs = sis33_acqs_zalloc(nr_events, ev_length); if (acqs == NULL) exit(EXIT_FAILURE); acq_events = sis33_fetch(dev, segment_nr, channel_nr, acqs, nr_events, NULL); if (acq_events < 0) exit(EXIT_FAILURE); if (show_tstamps) { if (sis33_event_timestamping_is_supported(dev)) print_timestamps(acqs, acq_events); else fprintf(stderr, "This device does not support event timestamping\n"); } else { print_acqs(acqs, acq_events); } sis33_acqs_free(acqs, nr_events); } if (sis33_close(dev)) exit(EXIT_FAILURE); return 0; }
int main(int argc, char *argv[]){ parse_args(argc, argv); int no_reps = args.no_reps; struct timespec *timestamps = calloc(no_reps, sizeof(struct timespec)); struct timespec *ts_ptr = timestamps; int i; for(ts_ptr = timestamps; ts_ptr < timestamps + no_reps; ts_ptr++){ clock_gettime(CLOCK_MONOTONIC_RAW, ts_ptr); } print_timestamps(timestamps, no_reps); return 0; }