From 2b2a0a580c1a9fcd437ebbda080dc3e03c00e554 Mon Sep 17 00:00:00 2001 From: Halil Durmus Date: Sat, 27 Jul 2024 18:44:49 +0300 Subject: [PATCH] ci: print elapsed time while generating files --- packages/generator/bin/generate.dart | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/generator/bin/generate.dart b/packages/generator/bin/generate.dart index 2c178f11a..17f4ca6be 100644 --- a/packages/generator/bin/generate.dart +++ b/packages/generator/bin/generate.dart @@ -243,7 +243,9 @@ void generateComApis(Scope scope, Map comTypesToGenerate) { } void main() async { - print('Loading Windows metadata...'); + final stopwatch = Stopwatch()..start(); + + print('[${stopwatch.elapsed}] Loading Windows metadata...'); final wdkScope = await MetadataStore.loadWdkMetadata(version: wdkMetadataVersion); final win32Scope = @@ -252,33 +254,35 @@ void main() async { // references from Win32 metadata. await MetadataStore.loadWinRTMetadata(); - print('Loading and sorting functions...'); + print('[${stopwatch.elapsed}] Loading and sorting functions...'); final functionsToGenerate = loadFunctionsFromJson(); saveFunctionsToJson(functionsToGenerate); - print('Generating struct_sizes.cpp...'); + print('[${stopwatch.elapsed}] Generating struct_sizes.cpp...'); final structsToGenerate = loadMap('win32_structs.json'); saveMap(structsToGenerate, 'win32_structs.json'); generateStructSizeAnalyzer(); - print('Generating structs...'); + print('[${stopwatch.elapsed}] Generating structs...'); generateStructs([wdkScope, win32Scope], structsToGenerate); - print('Generating struct tests...'); + print('[${stopwatch.elapsed}] Generating struct tests...'); generateStructSizeTests(); - print('Validating callbacks...'); + print('[${stopwatch.elapsed}] Validating callbacks...'); final callbacks = loadMap('win32_callbacks.json'); saveMap(callbacks, 'win32_callbacks.json'); // Win32 callbacks are manually created - print('Generating FFI function bindings...'); + print('[${stopwatch.elapsed}] Generating FFI function bindings...'); generateFunctions([wdkScope, win32Scope], functionsToGenerate); - print('Generating COM interfaces...'); + print('[${stopwatch.elapsed}] Generating COM interfaces...'); final comTypesToGenerate = loadMap('com_types.json'); saveMap(comTypesToGenerate, 'com_types.json'); generateComApis(win32Scope, comTypesToGenerate); MetadataStore.close(); + stopwatch.stop(); + print('[${stopwatch.elapsed}] Completed.'); }