OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 26 matching lines...) Expand all Loading... |
37 * @param {!Array<!WebInspector.TimelineModel.Filter>} filters | 37 * @param {!Array<!WebInspector.TimelineModel.Filter>} filters |
38 */ | 38 */ |
39 WebInspector.MemoryCountersGraph = function(delegate, model, filters) | 39 WebInspector.MemoryCountersGraph = function(delegate, model, filters) |
40 { | 40 { |
41 WebInspector.CountersGraph.call(this, delegate, model, filters); | 41 WebInspector.CountersGraph.call(this, delegate, model, filters); |
42 this._countersByName = {}; | 42 this._countersByName = {}; |
43 this._countersByName["jsHeapSizeUsed"] = this.createCounter(WebInspector.UIS
tring("JS Heap"), WebInspector.UIString("JS Heap: %s"), "hsl(220, 90%, 43%)", Nu
mber.bytesToString); | 43 this._countersByName["jsHeapSizeUsed"] = this.createCounter(WebInspector.UIS
tring("JS Heap"), WebInspector.UIString("JS Heap: %s"), "hsl(220, 90%, 43%)", Nu
mber.bytesToString); |
44 this._countersByName["documents"] = this.createCounter(WebInspector.UIString
("Documents"), WebInspector.UIString("Documents: %s"), "hsl(0, 90%, 43%)"); | 44 this._countersByName["documents"] = this.createCounter(WebInspector.UIString
("Documents"), WebInspector.UIString("Documents: %s"), "hsl(0, 90%, 43%)"); |
45 this._countersByName["nodes"] = this.createCounter(WebInspector.UIString("No
des"), WebInspector.UIString("Nodes: %s"), "hsl(120, 90%, 43%)"); | 45 this._countersByName["nodes"] = this.createCounter(WebInspector.UIString("No
des"), WebInspector.UIString("Nodes: %s"), "hsl(120, 90%, 43%)"); |
46 this._countersByName["jsEventListeners"] = this.createCounter(WebInspector.U
IString("Listeners"), WebInspector.UIString("Listeners: %s"), "hsl(38, 90%, 43%)
"); | 46 this._countersByName["jsEventListeners"] = this.createCounter(WebInspector.U
IString("Listeners"), WebInspector.UIString("Listeners: %s"), "hsl(38, 90%, 43%)
"); |
47 if (Runtime.experiments.isEnabled("gpuTimeline")) { | 47 this._gpuMemoryCounter = this.createCounter(WebInspector.UIString("GPU Memor
y"), WebInspector.UIString("GPU Memory [KB]: %s"), "hsl(300, 90%, 43%)", Number.
bytesToString); |
48 this._gpuMemoryCounter = this.createCounter(WebInspector.UIString("GPU M
emory"), WebInspector.UIString("GPU Memory [KB]: %s"), "hsl(300, 90%, 43%)", Num
ber.bytesToString); | 48 this._countersByName["gpuMemoryUsedKB"] = this._gpuMemoryCounter; |
49 this._countersByName["gpuMemoryUsedKB"] = this._gpuMemoryCounter; | |
50 } | |
51 } | 49 } |
52 | 50 |
53 WebInspector.MemoryCountersGraph.prototype = { | 51 WebInspector.MemoryCountersGraph.prototype = { |
54 /** | 52 /** |
55 * @override | 53 * @override |
56 */ | 54 */ |
57 refreshRecords: function() | 55 refreshRecords: function() |
58 { | 56 { |
59 this.reset(); | 57 this.reset(); |
60 var events = this._model.mainThreadEvents(); | 58 var events = this._model.mainThreadEvents(); |
61 for (var i = 0; i < events.length; ++i) { | 59 for (var i = 0; i < events.length; ++i) { |
62 var event = events[i]; | 60 var event = events[i]; |
63 if (event.name !== WebInspector.TimelineModel.RecordType.UpdateCount
ers) | 61 if (event.name !== WebInspector.TimelineModel.RecordType.UpdateCount
ers) |
64 continue; | 62 continue; |
65 | 63 |
66 var counters = event.args.data; | 64 var counters = event.args.data; |
67 if (!counters) | 65 if (!counters) |
68 return; | 66 return; |
69 for (var name in counters) { | 67 for (var name in counters) { |
70 var counter = this._countersByName[name]; | 68 var counter = this._countersByName[name]; |
71 if (counter) | 69 if (counter) |
72 counter.appendSample(event.startTime, counters[name]); | 70 counter.appendSample(event.startTime, counters[name]); |
73 } | 71 } |
74 | 72 |
75 var gpuMemoryLimitCounterName = "gpuMemoryLimitKB"; | 73 var gpuMemoryLimitCounterName = "gpuMemoryLimitKB"; |
76 if (this._gpuMemoryCounter && (gpuMemoryLimitCounterName in counters
)) | 74 if (gpuMemoryLimitCounterName in counters) |
77 this._gpuMemoryCounter.setLimit(counters[gpuMemoryLimitCounterNa
me]); | 75 this._gpuMemoryCounter.setLimit(counters[gpuMemoryLimitCounterNa
me]); |
78 } | 76 } |
79 this.scheduleRefresh(); | 77 this.scheduleRefresh(); |
80 }, | 78 }, |
81 | 79 |
82 __proto__: WebInspector.CountersGraph.prototype | 80 __proto__: WebInspector.CountersGraph.prototype |
83 } | 81 } |
OLD | NEW |