summaryrefslogtreecommitdiff
path: root/runtime/worker.rs
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/worker.rs')
-rw-r--r--runtime/worker.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/runtime/worker.rs b/runtime/worker.rs
index 2e2910109..4775b474c 100644
--- a/runtime/worker.rs
+++ b/runtime/worker.rs
@@ -27,6 +27,7 @@ use deno_core::ModuleCode;
use deno_core::ModuleId;
use deno_core::ModuleLoader;
use deno_core::ModuleSpecifier;
+use deno_core::OpMetricsSummaryTracker;
use deno_core::RuntimeOptions;
use deno_core::SharedArrayBufferStore;
use deno_core::Snapshot;
@@ -324,6 +325,18 @@ impl MainWorker {
}
}
+ // Hook up the summary metrics if the user or subcommand requested them
+ let (op_summary_metrics, op_metrics_factory_fn) =
+ if options.bootstrap.enable_op_summary_metrics {
+ let op_summary_metrics = Rc::new(OpMetricsSummaryTracker::default());
+ (
+ Some(op_summary_metrics.clone()),
+ Some(op_summary_metrics.op_metrics_factory_fn(|_| true)),
+ )
+ } else {
+ (None, None)
+ };
+
extensions.extend(std::mem::take(&mut options.extensions));
#[cfg(all(feature = "include_js_files_for_snapshotting", feature = "dont_create_runtime_snapshot", not(feature = "__runtime_js_sources")))]
@@ -349,9 +362,14 @@ impl MainWorker {
inspector: options.maybe_inspector_server.is_some(),
is_main: true,
feature_checker: Some(options.feature_checker.clone()),
+ op_metrics_factory_fn,
..Default::default()
});
+ if let Some(op_summary_metrics) = op_summary_metrics {
+ js_runtime.op_state().borrow_mut().put(op_summary_metrics);
+ }
+
if let Some(server) = options.maybe_inspector_server.clone() {
server.register_inspector(
main_module.to_string(),