In python, use: import time t1 = time.clock() # Do things here... t2 = time.clock() print t2 - t1 C/C++ under Windows: #include // For high-resolution timer functions. LARGE_INTEGER frequency, begin_count,end_count; BOOL result; double time_elapsed; result = QueryPerformanceFrequency(&frequency); assert(result); result = QueryPerformanceCounter(&begin_count); assert(result); // Do things here... result = QueryPerformanceCounter(&end_count); assert(result); time_elapsed = ((double)(end_count.QuadPart - begin_count.QuadPart)) / frequency.QuadPart; C/C++ under Linux: #include clock_t t1, t2; t1 = clock(); // Do things here... t2 = clock(); printf("It took %f seconds.\n", ((double)(t2 - t1))/CLOCKS_PER_SEC); Java: we only get millisecond resolution(?) long t1 = System.currentTimeMillis(); // Do things here... long t2 = System.currentTimeMillis(); System.out.println(t2 - t1); Perl: use Benchmark; $t0 = new Benchmark; # ... your CODE here ... $t1 = new Benchmark; $td = timediff($t1, $t0); print "the code took: ", timestr($td), "\n";