@@ -28,6 +28,7 @@ extern "C" {
2828// defined in util/output.h file, used privately here only
2929extern " C" BOOL output_video;
3030extern " C" BOOL output_verbose;
31+ extern " C" BOOL output_timing;
3132// Initialize the actual default values here if the config file is either successfully loaded before reading inputs or it failed to load.
3233static void init_default_values ()
3334{
@@ -191,6 +192,9 @@ int load_conf_file(const char *file_path)
191192 if (strcmp (" disable-verbose" , current_key) == 0 ) {
192193 output_verbose = !strtoul (strtok (NULL , NEWLINE_DELIMITER ), NULL , 10 );
193194 }
195+ if (strcmp (" disable-timing" , current_key) == 0 ) {
196+ output_timing = !strtoul (strtok (NULL , NEWLINE_DELIMITER ), NULL , 10 );
197+ }
194198 }
195199
196200 free (buffer);
@@ -219,10 +223,25 @@ static void run_tests()
219223 print (" %zu test(s) will be excluded." , tests_to_run_excluded.count ());
220224 }
221225 }
226+ ULONGLONG frequency;
227+ if (output_timing) {
228+ frequency = KeQueryPerformanceFrequency ();
229+ }
230+ ULONGLONG tick_start, tick_end;
222231 print (" -------------------------------------------------------------" );
223232 for (int i = 0 ; i < kernel_api_tests_size; i++) {
224233 if (tests_to_run.test (i)) {
234+ if (output_timing) {
235+ tick_start = KeQueryPerformanceCounter ();
236+ }
225237 kernel_api_tests[i].func (i + 1 , kernel_api_tests[i].name );
238+ if (output_timing) {
239+ tick_end = KeQueryPerformanceCounter ();
240+ ULONGLONG total_ms = ((tick_end - tick_start) * 1000 ) / frequency;
241+ ULONGLONG total_seconds = total_ms / 1000 ;
242+ ULONGLONG remainder_ms = total_ms % 1000 ;
243+ print (" %03u - %s: Test completed in %llu.%03llu seconds" , i + 1 , kernel_api_tests[i].name , total_seconds, remainder_ms);
244+ }
226245 }
227246 }
228247 print (" ------------------------ End of Tests -----------------------" );
0 commit comments