Example #1
0
/*---------------------------------------------------------------------------*/
void
timetable_aggregate_compute_detailed(struct timetable_aggregate *a,
				     struct timetable *timetable)
{
  int i;
  rtimer_clock_t t;

  t = timetable->timestamps[0].time;

  for(i = 1; i < *timetable->ptr; ++i) {
    struct timetable_aggregate_entry *entry;
    entry = find_aggregate(a, timetable->timestamps[i - 1].id);
    if(entry == NULL) {
      /* The list is full, skip this entry */
      /*      printf("detailed_timetable_aggregate_compute: list full\n");*/
    } else if(entry->id == NULL) {
      /* The id was found in the list, so we add it. */
      entry->id = timetable->timestamps[i - 1].id;
      entry->time = (unsigned long)(timetable->timestamps[i].time - t -
				    timetable_timestamp_time);
      entry->episodes = 1;
      /*      printf("New entry %s %lu\n", entry->id, entry->time);*/
    } else {
      entry->time += (unsigned long)(timetable->timestamps[i].time - t -
				     timetable_timestamp_time);
				     entry->episodes++;
    }
    t = timetable->timestamps[i].time;
    /*    printf("a ptr %d\n", a->ptr);*/
  }
}
Example #2
0
static void
detailed_profile_aggregates_compute(void)
{
    int i;
    rtimer_clock_t t;
    /*  const char *str = "profile_aggregates_compute";

    PROFILE_TIMESTAMP(str);*/

    t = profile_timestamps[0].time;

    for(i = 1; i < PROFILE_TIMESTAMP_PTR; ++i) {
        struct aggregate *a;
        a = find_aggregate(profile_timestamps[i - 1].ptr);
        if(a == NULL) {
            /* The list is full, skip this entry */
            printf("profile_aggregates_compute: list full\n");
        } else if(a->ptr == NULL) {
            a->ptr = profile_timestamps[i - 1].ptr;
            a->cycles = (unsigned long)(profile_timestamps[i].time - t);
            a->episodes = 1;
        } else {
            a->cycles += (unsigned long)(profile_timestamps[i].time - t);
            a->episodes++;
        }
        t = profile_timestamps[i].time;
    }

    /*  PROFILE_TIMESTAMP(str);*/

    /*printf("Aggregating time %u, len %d, list len %d, overhead %d\n",
     profile_timediff(str, str), PROFILE_TIMESTAMP_PTR,
     aggregates_list_ptr, profile_timestamp_time);*/


    /* print_aggregates();*/
}