summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/catapult/tracing/tracing/extras/system_stats/system_stats_snapshot.html
blob: 4b23769967e8f532b79b1ef13321c913d0226f62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!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/extras/chrome/cc/util.html">

<script>
'use strict';

tr.exportTo('tr.e.system_stats', function() {
  const ObjectSnapshot = tr.model.ObjectSnapshot;

  /**
   * @constructor
   */
  function SystemStatsSnapshot(objectInstance, ts, args) {
    ObjectSnapshot.apply(this, arguments);
    this.objectInstance = objectInstance;
    this.ts = ts;
    this.args = args;
    this.stats_ = args;
  }

  SystemStatsSnapshot.prototype = {
    __proto__: ObjectSnapshot.prototype,

    initialize() {
      if (this.args.length === 0) {
        throw new Error('No system stats snapshot data.');
      }
      this.stats_ = this.args;
    },

    getStats() {
      return this.stats_;
    },

    setStats(stats) {
      this.stats_ = stats;
    }
  };

  ObjectSnapshot.subTypes.register(
      SystemStatsSnapshot,
      {typeName: 'base::TraceEventSystemStatsMonitor::SystemStats'});

  return {
    SystemStatsSnapshot,
  };
});
</script>