blob: 1d4b86d2e635b8cdd77967d84aa33a46d209801b [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="/base/units/time_stamp.html">
<link rel="import" href="/model/timed_event.html">
<script>
'use strict';
/**
* @fileoverview Provides the Sample class.
*/
tr.exportTo('tr.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) {
tr.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__: tr.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 ' + tr.b.units.TimeStamp.format(this.start);
}
};
tr.model.EventRegistry.register(
Sample,
{
name: 'sample',
pluralName: 'samples',
singleViewElementName: 'tr-ui-a-single-sample-sub-view',
multiViewElementName: 'tr-ui-a-multi-sample-sub-view'
});
return {
Sample: Sample
};
});
</script>