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

Unified Diff: tools/telemetry/telemetry/core/timeline/counter.py

Issue 332213003: Move telemetry/core/timeline and timeline_data to telemetry/timeline. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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/core/timeline/counter.py
diff --git a/tools/telemetry/telemetry/core/timeline/counter.py b/tools/telemetry/telemetry/core/timeline/counter.py
deleted file mode 100644
index a35bf2ba7ad63b23adc01f42ed79c3b54da097df..0000000000000000000000000000000000000000
--- a/tools/telemetry/telemetry/core/timeline/counter.py
+++ /dev/null
@@ -1,94 +0,0 @@
-# Copyright 2013 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 telemetry.core.timeline.event_container as event_container
-
-# Doesn't inherit from TimelineEvent because its only a temporary wrapper of a
-# counter sample into an event. During stable operation, the samples are stored
-# a dense array of values rather than in the long-form done by an Event.
-class CounterSample(object):
- def __init__(self, counter, sample_index):
- self._counter = counter
- self._sample_index = sample_index
-
- @property
- def name(self):
- return None
-
- @property
- def start(self):
- return self._counter.timestamps[self._sample_index]
-
- @start.setter
- def start(self, start):
- self._counter.timestamps[self._sample_index] = start
-
- @property
- def duration(self):
- return 0
-
- @property
- def end(self):
- return self.start
-
- @property
- def thread_start(self):
- return None
-
- @property
- def thread_duration(self):
- return None
-
- @property
- def thread_end(self):
- return None
-
-
-class Counter(event_container.TimelineEventContainer):
- """ Stores all the samples for a given counter.
- """
- def __init__(self, parent, category, name):
- super(Counter, self).__init__(name, parent)
- self.category = category
- self.full_name = category + '.' + name
- self.samples = []
- self.timestamps = []
- self.series_names = []
- self.totals = []
- self.max_total = 0
-
- def IterChildContainers(self):
- return iter([])
-
- def IterEventsInThisContainer(self):
- for i in range(len(self.timestamps)):
- yield CounterSample(self, i)
-
- @property
- def num_series(self):
- return len(self.series_names)
-
- @property
- def num_samples(self):
- return len(self.timestamps)
-
- def FinalizeImport(self):
- if self.num_series * self.num_samples != len(self.samples):
- raise ValueError(
- 'Length of samples must be a multiple of length of timestamps.')
-
- self.totals = []
- self.max_total = 0
- if not len(self.samples):
- return
-
- max_total = None
- for i in xrange(self.num_samples):
- total = 0
- for j in xrange(self.num_series):
- total += self.samples[i * self.num_series + j]
- self.totals.append(total)
- if max_total is None or total > max_total:
- max_total = total
- self.max_total = max_total

Powered by Google App Engine
This is Rietveld 408576698