diff options
Diffstat (limited to 'query/chart_global_counters.js')
-rw-r--r-- | query/chart_global_counters.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/query/chart_global_counters.js b/query/chart_global_counters.js new file mode 100644 index 0000000..1708c01 --- /dev/null +++ b/query/chart_global_counters.js @@ -0,0 +1,58 @@ +function GrasChartGlobalCounts(args, panel) +{ + //input checking + if (args.block_ids.length != 0) throw gras_error_dialog( + "GrasChartGlobalCounts", + "Error making global counts chart.\n"+ + "Do not specify any blocks for this chart." + ); + + //settings + this.div = $('<div />').attr({class:'chart_total_counts'}); + $(panel).append(this.div); + this.title = "Global Counters" +} + +GrasChartGlobalCounts.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', 'default_allocator_bytes_allocated'], + ['Peak size', 'bytes', 'default_allocator_peak_bytes_allocated'], + ['Num mallocs', '', 'default_allocator_allocation_count'], + + ['Total msgs', '', 'framework_counter_messages_processed'], + ['Thread yields', '', 'framework_counter_yields'], + ['Local pushes', '', 'framework_counter_local_pushes'], + ['Shared pushes', '', 'framework_counter_shared_pushes'], + ['Msg queue max', '', 'framework_counter_mailbox_queue_max'], + ]; + + 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"); +} |