Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(407)

Unified Diff: tools/telemetry/telemetry/internal/util/global_hooks.py

Issue 1647513002: Delete tools/telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/internal/util/global_hooks.py
diff --git a/tools/telemetry/telemetry/internal/util/global_hooks.py b/tools/telemetry/telemetry/internal/util/global_hooks.py
deleted file mode 100644
index d34357552ea2dbcfa515eb928cf683b294936df2..0000000000000000000000000000000000000000
--- a/tools/telemetry/telemetry/internal/util/global_hooks.py
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Hooks that apply globally to all scripts that import or use Telemetry."""
-import signal
-import sys
-
-from telemetry.internal.util import exception_formatter
-
-
-def InstallHooks():
- InstallUnhandledExceptionFormatter()
- InstallStackDumpOnSigusr1()
- InstallTerminationHook()
-
-def InstallUnhandledExceptionFormatter():
- """Print prettier exceptions that also contain the stack frame's locals."""
- sys.excepthook = exception_formatter.PrintFormattedException
-
-
-def InstallStackDumpOnSigusr1():
- """Catch SIGUSR1 and print a stack trace."""
- # Windows doesn't define SIGUSR1.
- if not hasattr(signal, 'SIGUSR1'):
- return
-
- def PrintDiagnostics(_, stack_frame):
- exception_string = 'SIGUSR1 received, printed stack trace'
- exception_formatter.PrintFormattedFrame(stack_frame, exception_string)
- signal.signal(signal.SIGUSR1, PrintDiagnostics)
-
-
-def InstallTerminationHook():
- """Catch SIGTERM, print a stack trace, and exit."""
- def PrintStackAndExit(sig, stack_frame):
- exception_string = 'Received signal %s, exiting' % sig
- exception_formatter.PrintFormattedFrame(stack_frame, exception_string)
- sys.exit(-1)
- signal.signal(signal.SIGTERM, PrintStackAndExit)
« no previous file with comments | « tools/telemetry/telemetry/internal/util/file_handle_unittest.py ('k') | tools/telemetry/telemetry/internal/util/path.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698