diff --git a/js/public/friend/UsageStatistics.h b/js/public/friend/UsageStatistics.h index 9a0cb1bd8117..734019c0d6a5 100644 --- a/js/public/friend/UsageStatistics.h +++ b/js/public/friend/UsageStatistics.h @@ -314,6 +314,11 @@ FOR_EACH_JS_GLEAN_METRIC ( _ ) +_ +( +ION_COMPILE_TIME +TimeDuration_US +) # define FOR_EACH_JS_METRIC diff --git a/js/src/jit/CodeGenerator.h b/js/src/jit/CodeGenerator.h index c8900643d77c..31060463b435 100644 --- a/js/src/jit/CodeGenerator.h +++ b/js/src/jit/CodeGenerator.h @@ -1081,6 +1081,34 @@ data ; # endif +void +setCompilationTime +( +mozilla +: +: +TimeDuration +duration +) +{ +compileTime_ += +duration +; +} +mozilla +: +: +TimeDuration +getCompilationTime +( +) +const +{ +return +compileTime_ +; +} private : void @@ -2166,6 +2194,12 @@ perfSpewer_ uint32_t zoneStubsToReadBarrier_ ; +mozilla +: +: +TimeDuration +compileTime_ +; # ifdef FUZZING_JS_FUZZILLI diff --git a/js/src/jit/Ion.cpp b/js/src/jit/Ion.cpp index 0d913bfc5515..b4d78a65fa02 100644 --- a/js/src/jit/Ion.cpp +++ b/js/src/jit/Ion.cpp @@ -2463,6 +2463,35 @@ return false ; } +if +( +mozilla +: +: +TimeDuration +compileTime += +codegen +- +> +getCompilationTime +( +) +) +{ +cx +- +> +metrics +( +) +. +ION_COMPILE_TIME +( +compileTime +) +; +} return true ; @@ -9134,6 +9163,22 @@ spewEndFunction mir ) ; +mozilla +: +: +TimeStamp +compileStartTime += +mozilla +: +: +TimeStamp +: +: +Now +( +) +; { WarpCompilation comp @@ -9204,13 +9249,43 @@ return nullptr ; } -return +CodeGenerator +* +codegen += GenerateCode ( mir lir ) ; +if +( +codegen +) +{ +codegen +- +> +setCompilationTime +( +mozilla +: +: +TimeStamp +: +: +Now +( +) +- +compileStartTime +) +; +} +return +codegen +; } static AbortReasonOr diff --git a/js/xpconnect/metrics.yaml b/js/xpconnect/metrics.yaml index 90d4551ed48c..600555759353 100644 --- a/js/xpconnect/metrics.yaml +++ b/js/xpconnect/metrics.yaml @@ -348,6 +348,88 @@ expires never javascript . +ion +: +compile_time +: +type +: +timing_distribution +time_unit +: +microsecond +description +: +> +Time +in +microseconds +of +an +Ion +compilation +. +bugs +: +- +https +: +/ +/ +bugzilla +. +mozilla +. +org +/ +show_bug +. +cgi +? +id += +1918166 +data_reviews +: +- +https +: +/ +/ +bugzilla +. +mozilla +. +org +/ +show_bug +. +cgi +? +id += +1918166 +notification_emails +: +- +dpalmeiro +mozilla +. +com +- +perf +- +telemetry +- +alerts +mozilla +. +com +expires +: +never +javascript +. gc : total_time diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp index 32b303b8124a..c66c22207643 100644 --- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -14941,6 +14941,33 @@ sample ; break ; +case +JSMetric +: +: +ION_COMPILE_TIME +: +glean +: +: +javascript_ion +: +: +compile_time +. +AccumulateRawDuration +( +TimeDuration +: +: +FromMicroseconds +( +sample +) +) +; +break +; default : break