summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/buildstats.bbclass25
1 files changed, 15 insertions, 10 deletions
diff --git a/meta/classes/buildstats.bbclass b/meta/classes/buildstats.bbclass
index 4cd8fe6936..9690a04100 100644
--- a/meta/classes/buildstats.bbclass
+++ b/meta/classes/buildstats.bbclass
@@ -61,11 +61,13 @@ def set_device(e):
61 # we do not collect diskstats as the method to collect meaningful statistics 61 # we do not collect diskstats as the method to collect meaningful statistics
62 # for these fs types requires a bit more research. 62 # for these fs types requires a bit more research.
63 ############################################################################ 63 ############################################################################
64 for line in open("/proc/diskstats", "r"): 64 rdev="NoLogicalDevice"
65 if majordev == int(line.split()[0]) and minordev == int(line.split()[1]): 65 try:
66 rdev=line.split()[2] 66 for line in open("/proc/diskstats", "r"):
67 else: 67 if majordev == int(line.split()[0]) and minordev == int(line.split()[1]):
68 rdev="NoLogicalDevice" 68 rdev=line.split()[2]
69 except:
70 pass
69 file = open(e.data.getVar('DEVFILE', True), "w") 71 file = open(e.data.getVar('DEVFILE', True), "w")
70 file.write(rdev) 72 file.write(rdev)
71 file.close() 73 file.close()
@@ -82,12 +84,15 @@ def get_diskstats(dev):
82 # For info on what these are, see kernel doc file iostats.txt 84 # For info on what these are, see kernel doc file iostats.txt
83 ############################################################################ 85 ############################################################################
84 DSTAT_KEYS = ['ReadsComp', 'ReadsMerged', 'SectRead', 'TimeReads', 'WritesComp', 'SectWrite', 'TimeWrite', 'IOinProgress', 'TimeIO', 'WTimeIO'] 86 DSTAT_KEYS = ['ReadsComp', 'ReadsMerged', 'SectRead', 'TimeReads', 'WritesComp', 'SectWrite', 'TimeWrite', 'IOinProgress', 'TimeIO', 'WTimeIO']
85 for x in open("/proc/diskstats", "r"): 87 try:
86 if dev in x: 88 for x in open("/proc/diskstats", "r"):
87 diskstats_val = x.rstrip().split()[4:] 89 if dev in x:
88 diskstats = dict(itertools.izip(DSTAT_KEYS, diskstats_val)) 90 diskstats_val = x.rstrip().split()[4:]
91 except IOError as e:
92 return
93 diskstats = dict(itertools.izip(DSTAT_KEYS, diskstats_val))
89 return diskstats 94 return diskstats
90 95
91def set_diskdata(var, dev, data): 96def set_diskdata(var, dev, data):
92 data.setVar(var, get_diskstats(dev)) 97 data.setVar(var, get_diskstats(dev))
93 98