Chris Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <!-- |
Chris Craik | 24385db | 2015-06-11 11:16:26 -0700 | [diff] [blame] | 3 | Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 4 | Use of this source code is governed by a BSD-style license that can be |
| 5 | found in the LICENSE file. |
Chris Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 6 | --> |
| 7 | |
Chris Craik | 24385db | 2015-06-11 11:16:26 -0700 | [diff] [blame] | 8 | <link rel="import" href="/extras/chrome/cc/util.html"> |
Chris Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 9 | |
| 10 | <script> |
| 11 | 'use strict'; |
| 12 | |
Chris Craik | 24385db | 2015-06-11 11:16:26 -0700 | [diff] [blame] | 13 | tr.exportTo('tr.e.system_stats', function() { |
| 14 | var ObjectSnapshot = tr.model.ObjectSnapshot; |
Chris Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 15 | |
| 16 | /** |
| 17 | * @constructor |
| 18 | */ |
| 19 | function SystemStatsSnapshot(objectInstance, ts, args) { |
| 20 | ObjectSnapshot.apply(this, arguments); |
| 21 | this.objectInstance = objectInstance; |
| 22 | this.ts = ts; |
| 23 | this.args = args; |
| 24 | this.stats = args; |
| 25 | } |
| 26 | |
| 27 | SystemStatsSnapshot.prototype = { |
| 28 | __proto__: ObjectSnapshot.prototype, |
| 29 | |
| 30 | initialize: function() { |
| 31 | if (this.args.length == 0) |
| 32 | throw new Error('No system stats snapshot data.'); |
| 33 | this.stats_ = this.args; |
| 34 | }, |
| 35 | |
| 36 | getStats: function() { |
| 37 | return this.stats_; |
| 38 | }, |
| 39 | |
| 40 | setStats: function(stats) { |
| 41 | this.stats_ = stats; |
| 42 | } |
| 43 | }; |
| 44 | |
| 45 | ObjectSnapshot.register( |
| 46 | SystemStatsSnapshot, |
| 47 | {typeName: 'base::TraceEventSystemStatsMonitor::SystemStats'}); |
| 48 | |
| 49 | return { |
| 50 | SystemStatsSnapshot: SystemStatsSnapshot |
| 51 | }; |
| 52 | }); |
| 53 | </script> |