I'm new to this, so this may sound stupid.
// determine dictionary's size getrusage(RUSAGE_SELF, &before); unsigned int n = size(); getrusage(RUSAGE_SELF, &after); // calculate time to determine dictionary's size time_size = calculate(&before, &after);
What is the first getrusage's job? It's supposed update resource usage stats about the current process into the struct rusage. But what is the current process here? Does it only include calling getrusage()? Then how does the 2nd getrusage, get stats about the resource usage stats about size(), the first arg is RUSAGE_SELF?