int process_latencies()

in src/latencies_stats.c [50:73]


int process_latencies(unsigned long max_latency)
{
    node_t * temp = NULL;

    freq_table = (unsigned long*) malloc(sizeof(unsigned long) * (max_latency + 1));

    if(!freq_table)
        return ERROR_MEMORY_ALLOC;

    memset(freq_table, 0, (max_latency + 1) * sizeof(unsigned long));

    if(head == NULL)
        return ERROR_GENERAL;

    /* Using the latencies stored in the linked list as keys,
       increments at latency in frequency table */
    temp = head;
    while(temp != NULL) {
        freq_table[temp->lat]++;
        temp = temp->next;
    }

    return NO_ERR;
}