diff options
author | Josh Blum | 2013-05-06 02:44:24 -0700 |
---|---|---|
committer | Josh Blum | 2013-05-06 02:44:24 -0700 |
commit | 770955f266603f0dad54e7aec8f8c0aa65a15f51 (patch) | |
tree | 2a8a56dc4ca804192def0aae420c8010fdb2fe70 /python/gras/query/chart_allocator_counts.js | |
parent | 1818f96690423650d3eff31291b827b4ef2690e8 (diff) | |
parent | 7139a4cb92091938692b3d640c20fbb300bb0929 (diff) | |
download | sandhi-770955f266603f0dad54e7aec8f8c0aa65a15f51.tar.gz sandhi-770955f266603f0dad54e7aec8f8c0aa65a15f51.tar.bz2 sandhi-770955f266603f0dad54e7aec8f8c0aa65a15f51.zip |
Merge branch 'theron6_work'
Diffstat (limited to 'python/gras/query/chart_allocator_counts.js')
-rw-r--r-- | python/gras/query/chart_allocator_counts.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/python/gras/query/chart_allocator_counts.js b/python/gras/query/chart_allocator_counts.js new file mode 100644 index 0000000..5219672 --- /dev/null +++ b/python/gras/query/chart_allocator_counts.js @@ -0,0 +1,52 @@ +function GrasChartAllocatorCounts(args, panel) +{ + //input checking + if (args.block_ids.length != 0) throw gras_error_dialog( + "GrasChartAllocatorCounts", + "Error making allocator counts chart.\n"+ + "Do not specify any blocks for this chart." + ); + + //settings + this.div = $('<div />').attr({class:'chart_total_io_counts'}); + $(panel).append(this.div); + this.title = "Theron allocator counts" +} + +GrasChartAllocatorCounts.prototype.update = function(point) +{ + var ul = $('<ul />'); + $('ul', this.div).remove(); //clear old lists + this.div.append(ul); + + function make_entry(strong, span) + { + var li = $('<li />'); + var strong = $('<strong />').text(strong + ": "); + var span = $('<span />').text(span); + li.append(strong); + li.append(span); + ul.append(li); + } + + var stuff = [ + ['Allocated', 'bytes', 'bytes_allocated'], + ['Peak size', 'bytes', 'peak_bytes_allocated'], + ['Malloc\'d', 'times', 'allocation_count'], + ]; + + var entries = 0; + $.each(stuff, function(contents_i, contents) + { + var dir = contents[0]; + var units = contents[1]; + var key = contents[2]; + var count = (key in point)? point[key] : 0; + if (count > 0) + { + make_entry(dir, count.toString() + ' ' + units); + entries++; + } + }); + if (entries == 0) make_entry("Counts", "none"); +} |