1
0
Fork 0

iocost_monitor: drop string wrap around numbers when outputting json

[ Upstream commit 21f3cfeab3 ]

Wrapping numbers in strings is used by some to work around bit-width issues in
some enviroments. The problem isn't innate to json and the workaround seems to
cause more integration problems than help. Let's drop the string wrapping.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5.4-rM2-2.2.x-imx-squashed
Tejun Heo 2020-04-13 12:27:58 -04:00 committed by Greg Kroah-Hartman
parent 5934e22709
commit 7b88ccc137
1 changed files with 21 additions and 21 deletions

View File

@ -112,14 +112,14 @@ class IocStat:
def dict(self, now): def dict(self, now):
return { 'device' : devname, return { 'device' : devname,
'timestamp' : str(now), 'timestamp' : now,
'enabled' : str(int(self.enabled)), 'enabled' : self.enabled,
'running' : str(int(self.running)), 'running' : self.running,
'period_ms' : str(self.period_ms), 'period_ms' : self.period_ms,
'period_at' : str(self.period_at), 'period_at' : self.period_at,
'period_vtime_at' : str(self.vperiod_at), 'period_vtime_at' : self.vperiod_at,
'busy_level' : str(self.busy_level), 'busy_level' : self.busy_level,
'vrate_pct' : str(self.vrate_pct), } 'vrate_pct' : self.vrate_pct, }
def table_preamble_str(self): def table_preamble_str(self):
state = ('RUN' if self.running else 'IDLE') if self.enabled else 'OFF' state = ('RUN' if self.running else 'IDLE') if self.enabled else 'OFF'
@ -179,19 +179,19 @@ class IocgStat:
def dict(self, now, path): def dict(self, now, path):
out = { 'cgroup' : path, out = { 'cgroup' : path,
'timestamp' : str(now), 'timestamp' : now,
'is_active' : str(int(self.is_active)), 'is_active' : self.is_active,
'weight' : str(self.weight), 'weight' : self.weight,
'weight_active' : str(self.active), 'weight_active' : self.active,
'weight_inuse' : str(self.inuse), 'weight_inuse' : self.inuse,
'hweight_active_pct' : str(self.hwa_pct), 'hweight_active_pct' : self.hwa_pct,
'hweight_inuse_pct' : str(self.hwi_pct), 'hweight_inuse_pct' : self.hwi_pct,
'inflight_pct' : str(self.inflight_pct), 'inflight_pct' : self.inflight_pct,
'debt_ms' : str(self.debt_ms), 'debt_ms' : self.debt_ms,
'use_delay' : str(self.use_delay), 'use_delay' : self.use_delay,
'delay_ms' : str(self.delay_ms), 'delay_ms' : self.delay_ms,
'usage_pct' : str(self.usage), 'usage_pct' : self.usage,
'address' : str(hex(self.address)) } 'address' : self.address }
for i in range(len(self.usages)): for i in range(len(self.usages)):
out[f'usage_pct_{i}'] = str(self.usages[i]) out[f'usage_pct_{i}'] = str(self.usages[i])
return out return out