blob: c4b65714ef98508feb3da5cc21b2040f3dfc81e8 [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="/core/trace_model/timed_event.html">
<script>
'use strict';
/**
* @fileoverview Provides the Sample class.
*/
tv.exportTo('tv.c.trace_model', function() {
/**
* A Sample represents a sample taken at an instant in time, plus its stack
* frame and parameters associated with that sample.
*
* @constructor
*/
function Sample(cpu, thread, title, start, leafStackFrame,
opt_weight, opt_args) {
tv.c.trace_model.TimedEvent.call(this, start);
this.title = title;
this.cpu = cpu;
this.thread = thread;
this.leafStackFrame = leafStackFrame;
this.weight = opt_weight;
this.args = opt_args || {};
}
Sample.prototype = {
__proto__: tv.c.trace_model.TimedEvent.prototype,
get colorId() {
return this.leafStackFrame.colorId;
},
get stackTrace() {
return this.leafStackFrame.stackTrace;
},
getUserFriendlyStackTrace: function() {
return this.leafStackFrame.getUserFriendlyStackTrace();
},
get userFriendlyName() {
return 'Sample ' + ' at ' +
tv.c.analysis.tsString(this.start);
}
};
tv.c.trace_model.EventRegistry.register(
Sample,
{
name: 'sample',
pluralName: 'samples',
singleViewElementName: 'tv-c-single-sample-sub-view',
multiViewElementName: 'tv-c-multi-sample-sub-view'
});
return {
Sample: Sample
};
});
</script>