8 int main(int argc, char *argv[])
10 double this_time, last_time;
11 char line[256], last_line[256], *p;
12 int major, minor, cpu, nr, alias;
14 unsigned long long total_entries;
15 unsigned int *last_seq;
19 #ifdef _SC_NPROCESSORS_ONLN
20 MAX_CPUS = sysconf(_SC_NPROCESSORS_ONLN);
23 fprintf(stderr, "Could not determine number of CPUs online:\n%s\n",
25 fprintf(stderr, "Assuming 1024\n");
29 MAX_CPUS = CPU_SETSIZE;
32 last_seq = malloc( sizeof(unsigned int) * MAX_CPUS );
33 for (nr = 0; nr < MAX_CPUS; nr++)
37 fprintf(stderr, "%s: file\n", argv[0]);
41 f = fopen(argv[1], "r");
50 while ((p = fgets(line, sizeof(line), f)) != NULL) {
51 if (sscanf(p, "%3d,%3d %5d %8d %lf", &major, &minor, &cpu, &seq, &this_time) != 5)
54 if (this_time < last_time) {
55 fprintf(stdout, "last: %s", last_line);
56 fprintf(stdout, "this: %s", p);
60 last_time = this_time;
62 if (cpu >= MAX_CPUS) {
63 fprintf(stderr, "cpu%d too large\n", cpu);
67 if (last_seq[cpu] == seq) {
68 fprintf(stdout, "alias on sequence %u\n", seq);
74 strcpy(last_line, line);
77 fprintf(stdout, "Events %Lu: %d unordered, %d aliases\n", total_entries, nr, alias);