Beispiel #1
0
int main (int argc, char **argv)
{
    int error = 0;
    Vector *vector = vector_new ();
    
    if (vector_load_from_file (vector, argc, argv))
    {
        Stopwatch *stopwatch = stopwatch_new ();
        uint64_t inversions = 0;

        stopwatch_start (stopwatch);
        
        inversions = count_inversions (vector);
        
        stopwatch_stop (stopwatch);
        
        printf ("%llu inversions of %zu numbers in %llu.%03u ms.\n", inversions, vector->length, stopwatch->elapsed, stopwatch->usec);
        
        stopwatch_free (stopwatch);
    }
    else
    {
        error = 1;
    }
    
    vector_free (vector);
    
    return error;
}
Beispiel #2
0
void profiler_free(PROFILER* profiler)
{	
	stopwatch_free(profiler->stopwatch);
	
	free(profiler);
}