Code Duplication    Length = 12-13 lines in 2 locations

plumd/plugins/readers/linux/proc.py 2 locations

@@ 99-111 (lines=13) @@
96
        return ret
97
98
99
    def proc_stat_cpu(self, key, val, ts):
100
        ret = []
101
        total = sum([ float(i) for i in val])
102
        cpu = self.config.get('cpu_metrics')
103
        for map_val in cpu:
104
            if len(val) < 1:
105
                break
106
            metric_val = float(val.popleft())
107
            mstr = "{0}.{1}".format(key, map_val)
108
            percent_val = float(metric_val / total) * 100.00
109
            mval = self.calc.per_second(key, percent_val, ts)
110
            ret.append(plumd.Float(mstr, mval))
111
        return ret
112
113
114
    def proc_stat(self):
@@ 85-96 (lines=12) @@
82
        return ret
83
84
85
    def proc_stat_cpu_percent(self, key, val, ts):
86
        ret = []
87
        total = sum([ float(i) for i in val])
88
        cpu = self.config.get('cpu_metrics')
89
        for map_val in cpu:
90
            if len(val) < 1:
91
                break
92
            metric_val = float(val.popleft())
93
            mstr = "{0}.{1}".format(key, map_val)
94
            percent_val = metric_val / total * 100.00
95
            ret.append(plumd.Float(mstr, percent_val))
96
        return ret
97
98
99
    def proc_stat_cpu(self, key, val, ts):