def get_mc_stats_per_node(self, mc, stats):
        cmd_list = ["timings", "tap", "checkpoint", "memory", ""]
        #cmd_list = ["tap"]
        try:
            for cmd in cmd_list:
                node_stats = mc.stats(cmd)
                if node_stats:
                    if cmd == "timings":
                        # need to preprocess histogram data first
                        vals = sorted([self.seg(*kv) for kv in node_stats.items()])
                        dd = {}
                        totals = {}
                        longest = 0
                        for s in vals:
                            avg = (s[0][1] + s[0][2]) / 2
                            k = s[0][0]
                            l = dd.get(k, [])
                            l.append((avg, s[1]))
                            dd[k] = l
                            totals[k] = totals.get(k, 0) + s[1]
                        for k in sorted(dd):
                            ccount = 0
                            for lbl,v in dd[k]:
                                ccount += v * lbl
                            stats[k] = ccount / totals[k]
                    else:
                        for key, val in node_stats.items():
                            stats[key] = val
        except Exception, err:
            traceback.print_exc()
dataset/ETHPy150Open membase/membase-cli/collector.py/StatsCollector.get_mc_stats_per_node/original