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

Unified Diff: common/py_trace_event/py_trace_event/trace_event_impl/meta_class.py

Issue 2301523007: Add trace events for some of telemetry internal functions (Closed)
Patch Set: Address Petr's nit Created 4 years, 3 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: common/py_trace_event/py_trace_event/trace_event_impl/meta_class.py
diff --git a/common/py_trace_event/py_trace_event/trace_event_impl/meta_class.py b/common/py_trace_event/py_trace_event/trace_event_impl/meta_class.py
new file mode 100644
index 0000000000000000000000000000000000000000..4ede79bd338fac7ba31e45d0bbe3b14fba790b96
--- /dev/null
+++ b/common/py_trace_event/py_trace_event/trace_event_impl/meta_class.py
@@ -0,0 +1,16 @@
+# Copyright 2016 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.
+
+import types
+
+from py_trace_event.trace_event_impl import decorators
+
+
+class TracedMetaClass(type):
+ def __new__(cls, name, bases, attrs):
+ for attr_name, attr_value in attrs.iteritems():
+ if isinstance(attr_value, types.FunctionType):
+ attrs[attr_name] = decorators.traced(attr_value)
+
+ return super(TracedMetaClass, cls).__new__(cls, name, bases, attrs)
« no previous file with comments | « common/py_trace_event/py_trace_event/trace_event_impl/log.py ('k') | firefighter/default/tracing/third_party » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698