diff options
author | Josh Blum | 2013-05-10 00:00:47 -0700 |
---|---|---|
committer | Josh Blum | 2013-05-10 00:00:47 -0700 |
commit | 121a609ed2cadd50e5e85093e2ac524bdd279d02 (patch) | |
tree | e7a95104623487bb0b7027bc2bbc142e741ce200 /python/gras/query/chart_port_counters.js | |
parent | a1b87fea68e78da0bb3f047a34f3ddc17372cd5c (diff) | |
download | sandhi-121a609ed2cadd50e5e85093e2ac524bdd279d02.tar.gz sandhi-121a609ed2cadd50e5e85093e2ac524bdd279d02.tar.bz2 sandhi-121a609ed2cadd50e5e85093e2ac524bdd279d02.zip |
gras: added more theron counters + query work
Diffstat (limited to 'python/gras/query/chart_port_counters.js')
-rw-r--r-- | python/gras/query/chart_port_counters.js | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/python/gras/query/chart_port_counters.js b/python/gras/query/chart_port_counters.js new file mode 100644 index 0000000..af74c33 --- /dev/null +++ b/python/gras/query/chart_port_counters.js @@ -0,0 +1,76 @@ +function GrasChartPortCounts(args, panel) +{ + //input checking + if (args.block_ids.length != 1) throw gras_error_dialog( + "GrasChartPortCounts", + "Error making total port counts chart.\n"+ + "Specify only one block for this chart." + ); + + //settings + this.block_id = args.block_ids[0]; + this.div = $('<div />').attr({class:'chart_total_counts'}); + $(panel).append(this.div); + this.title = "Port Counters - " + this.block_id; +} + +GrasChartPortCounts.prototype.update = function(point) +{ + var block_data = point.blocks[this.block_id]; + if (!block_data) return; + 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); + } + + //create total time elapsed entry + { + var init_time = block_data.init_time; + var stats_time = block_data.stats_time; + var tps = block_data.tps; + var duration = (stats_time - init_time)/tps; + make_entry('Elapsed', duration.toFixed(2).toString() + ' secs'); + } + + var stuff = [ + ['Enque', 'items', 'items_enqueued'], + ['Enque', 'tags', 'tags_enqueued'], + ['Enque', 'msgs', 'msgs_enqueued'], + ['Input', 'items', 'items_consumed'], + ['Input', 'tags', 'tags_consumed'], + ['Input', 'msgs', 'msgs_consumed'], + ['Output', 'items', 'items_produced'], + ['Output', 'tags', 'tags_produced'], + ['Output', 'msgs', 'msgs_produced'], + ['Copied', 'bytes', 'bytes_copied'], + ]; + + $.each(stuff, function(contents_i, contents) + { + var dir = contents[0]; + var units = contents[1]; + var key = contents[2]; + $.each(block_data[key], function(index, count) + { + if (count > 0) + { + make_entry(dir + index.toString(), count.toString() + ' ' + units); + } + }); + }); + + var actor_depth = block_data.actor_queue_depth; + if (actor_depth > 10) //only show if its large + { + make_entry('Actor depth', actor_depth.toString() + ' msgs'); + } +} |