blob: f67d20d3e5df41e8702b55d1b1e9c950e25ae7d4 [file] [log] [blame]
<!DOCTYPE html>
<!--
Copyright (c) 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.
-->
<link rel="import" href="/tracing/model/slice.html">
<script>
'use strict';
/**
* @fileoverview Provides the Thread class.
*/
tr.exportTo('tr.model', function() {
const Slice = tr.model.Slice;
/**
* A ThreadSlice represents an interval of time on a thread resource
* with associated nesting slice information.
*
* ThreadSlices are typically associated with a specific trace event pair on a
* specific thread.
* For example,
* TRACE_EVENT_BEGIN1("x","myArg", 7) at time=0.1ms
* TRACE_EVENT_END0() at time=0.3ms
* This results in a single slice from 0.1 with duration 0.2 on a
* specific thread.
*
* @constructor
*/
function ThreadSlice(cat, title, colorId, start, args, opt_duration,
opt_cpuStart, opt_cpuDuration, opt_argsStripped,
opt_bindId) {
Slice.call(this, cat, title, colorId, start, args, opt_duration,
opt_cpuStart, opt_cpuDuration, opt_argsStripped, opt_bindId);
// Do not modify this directly.
// subSlices is configured by SliceGroup.rebuildSubRows_.
this.subSlices = [];
}
ThreadSlice.prototype = {
__proto__: Slice.prototype,
get overlappingSamples() {
const samples = new tr.model.EventSet();
if (!this.parentContainer || !this.parentContainer.samples) {
return samples;
}
this.parentContainer.samples.forEach(function(sample) {
if (this.start <= sample.start && sample.start <= this.end) {
samples.push(sample);
}
}, this);
return samples;
}
};
tr.model.EventRegistry.register(
ThreadSlice,
{
name: 'slice',
pluralName: 'slices'
});
return {
ThreadSlice,
};
});
</script>