From 4a7ac0b84b75f66a9cf1082710f0a2148a260c13 Mon Sep 17 00:00:00 2001 From: Fabian Zickgraf Date: Mon, 9 Oct 2023 11:39:04 +0200 Subject: [PATCH] Introduce CallFuncListWithUserTime a version of CallFuncListWithTime which uses `Runtime` instead of `NanosecondsSinceEpoch` --- ToolsForHomalg/PackageInfo.g | 2 +- ToolsForHomalg/gap/ToolsForHomalg.gd | 1 + ToolsForHomalg/gap/ToolsForHomalg.gi | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ToolsForHomalg/PackageInfo.g b/ToolsForHomalg/PackageInfo.g index 576e72248..83746c9bb 100644 --- a/ToolsForHomalg/PackageInfo.g +++ b/ToolsForHomalg/PackageInfo.g @@ -10,7 +10,7 @@ SetPackageInfo( rec( PackageName := "ToolsForHomalg", Subtitle := "Special methods and knowledge propagation tools", -Version := "2023.07-01", +Version := "2023.10-01", Date := (function ( ) if IsBound( GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE ) then return GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE; else return Concatenation( ~.Version{[ 1 .. 4 ]}, "-", ~.Version{[ 6, 7 ]}, "-01" ); fi; end)( ), License := "GPL-2.0-or-later", diff --git a/ToolsForHomalg/gap/ToolsForHomalg.gd b/ToolsForHomalg/gap/ToolsForHomalg.gd index 63f54cb09..fb8c74119 100644 --- a/ToolsForHomalg/gap/ToolsForHomalg.gd +++ b/ToolsForHomalg/gap/ToolsForHomalg.gd @@ -454,6 +454,7 @@ DeclareOperation( "ShaSum", DeclareGlobalFunction( "GetTimeOfDay" ); DeclareGlobalFunction( "CallFuncListWithTime" ); +DeclareGlobalFunction( "CallFuncListWithUserTime" ); #! @Description #! returns a new list that contains for each element elm of the list list a list of length two, diff --git a/ToolsForHomalg/gap/ToolsForHomalg.gi b/ToolsForHomalg/gap/ToolsForHomalg.gi index 6441e56f6..d748d0edf 100644 --- a/ToolsForHomalg/gap/ToolsForHomalg.gi +++ b/ToolsForHomalg/gap/ToolsForHomalg.gi @@ -1703,6 +1703,29 @@ InstallGlobalFunction( CallFuncListWithTime, end ); +## +InstallGlobalFunction( CallFuncListWithUserTime, + function( func, arguments ) + local output, t0, t1; + + if not IsList( arguments ) then + + return CallFuncListWithUserTime( func, [ arguments ] ); + + fi; + + t0 := Runtime( ); + + output := CallFuncList( func, arguments ); + + t1 := Runtime( ); + + Print( t1 - t0, " ms\n" ); + + return output; + +end ); + ## InstallGlobalFunction( CollectEntries, function( list )