summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-05-06 17:19:25 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-05-07 13:40:36 +0100
commitc045129ce9089965e4c47051b2b61faedbd5052d (patch)
treed075946a825f54a508f5fb16f55faf582aafa52c
parent6ca0be7f9cae17a946bd043786473ef664b9f95b (diff)
downloadpoky-c045129ce9089965e4c47051b2b61faedbd5052d.tar.gz
classes/buildstats: whitespace cleanup
* Drop trailing whitespace * Use spaces around equals in assignments * Replace an errant tab with spaces (From OE-Core rev: e6d2b407979869219da1f15ed4b5c1c804548fce) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/buildstats.bbclass50
1 files changed, 25 insertions, 25 deletions
diff --git a/meta/classes/buildstats.bbclass b/meta/classes/buildstats.bbclass
index 48442641d4..f15c45dbc7 100644
--- a/meta/classes/buildstats.bbclass
+++ b/meta/classes/buildstats.bbclass
@@ -3,12 +3,12 @@ BNFILE = "${BUILDSTATS_BASE}/.buildname"
3DEVFILE = "${BUILDSTATS_BASE}/.device" 3DEVFILE = "${BUILDSTATS_BASE}/.device"
4 4
5################################################################################ 5################################################################################
6# Build statistics gathering. 6# Build statistics gathering.
7# 7#
8# The CPU and Time gathering/tracking functions and bbevent inspiration 8# The CPU and Time gathering/tracking functions and bbevent inspiration
9# were written by Christopher Larson and can be seen here: 9# were written by Christopher Larson and can be seen here:
10# http://kergoth.pastey.net/142813 10# http://kergoth.pastey.net/142813
11# 11#
12################################################################################ 12################################################################################
13 13
14def get_process_cputime(pid): 14def get_process_cputime(pid):
@@ -43,36 +43,36 @@ def set_device(e):
43 except: 43 except:
44 pass 44 pass
45 ############################################################################ 45 ############################################################################
46 # We look for the volume TMPDIR lives on. To do all disks would make little 46 # We look for the volume TMPDIR lives on. To do all disks would make little
47 # sense and not give us any particularly useful data. In theory we could do 47 # sense and not give us any particularly useful data. In theory we could do
48 # something like stick DL_DIR on a different partition and this would 48 # something like stick DL_DIR on a different partition and this would
49 # throw stats gathering off. The same goes with SSTATE_DIR. However, let's 49 # throw stats gathering off. The same goes with SSTATE_DIR. However, let's
50 # get the basics in here and work on the cornercases later. 50 # get the basics in here and work on the cornercases later.
51 # A note. /proc/diskstats does not contain info on encryptfs, tmpfs, etc. 51 # A note. /proc/diskstats does not contain info on encryptfs, tmpfs, etc.
52 # If we end up hitting one of these fs, we'll just skip diskstats collection. 52 # If we end up hitting one of these fs, we'll just skip diskstats collection.
53 ############################################################################ 53 ############################################################################
54 device=os.stat(tmpdir) 54 device = os.stat(tmpdir)
55 majordev=os.major(long(device.st_dev)) 55 majordev = os.major(long(device.st_dev))
56 minordev=os.minor(long(device.st_dev)) 56 minordev = os.minor(long(device.st_dev))
57 ############################################################################ 57 ############################################################################
58 # Bug 1700: 58 # Bug 1700:
59 # Because tmpfs/encryptfs/ramfs etc inserts no entry in /proc/diskstats 59 # Because tmpfs/encryptfs/ramfs etc inserts no entry in /proc/diskstats
60 # we set rdev to NoLogicalDevice and search for it later. If we find NLD 60 # we set rdev to NoLogicalDevice and search for it later. If we find NLD
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 rdev="NoLogicalDevice" 64 rdev = "NoLogicalDevice"
65 try: 65 try:
66 with open("/proc/diskstats", "r") as f: 66 with open("/proc/diskstats", "r") as f:
67 for line in f: 67 for line in f:
68 if majordev == int(line.split()[0]) and minordev == int(line.split()[1]): 68 if majordev == int(line.split()[0]) and minordev == int(line.split()[1]):
69 rdev=line.split()[2] 69 rdev = line.split()[2]
70 except: 70 except:
71 pass 71 pass
72 file = open(e.data.getVar('DEVFILE', True), "w") 72 file = open(e.data.getVar('DEVFILE', True), "w")
73 file.write(rdev) 73 file.write(rdev)
74 file.close() 74 file.close()
75 75
76def get_device(e): 76def get_device(e):
77 file = open(e.data.getVar('DEVFILE', True)) 77 file = open(e.data.getVar('DEVFILE', True))
78 device = file.readline() 78 device = file.readline()
@@ -84,7 +84,7 @@ def get_diskstats(dev):
84 ############################################################################ 84 ############################################################################
85 # For info on what these are, see kernel doc file iostats.txt 85 # For info on what these are, see kernel doc file iostats.txt
86 ############################################################################ 86 ############################################################################
87 DSTAT_KEYS = ['ReadsComp', 'ReadsMerged', 'SectRead', 'TimeReads', 'WritesComp', 'SectWrite', 'TimeWrite', 'IOinProgress', 'TimeIO', 'WTimeIO'] 87 DSTAT_KEYS = ['ReadsComp', 'ReadsMerged', 'SectRead', 'TimeReads', 'WritesComp', 'SectWrite', 'TimeWrite', 'IOinProgress', 'TimeIO', 'WTimeIO']
88 try: 88 try:
89 with open("/proc/diskstats", "r") as f: 89 with open("/proc/diskstats", "r") as f:
90 for x in f: 90 for x in f:
@@ -106,9 +106,9 @@ def get_diskdata(var, dev, data):
106 newdiskdata = get_diskstats(dev) 106 newdiskdata = get_diskstats(dev)
107 for key in olddiskdata.iterkeys(): 107 for key in olddiskdata.iterkeys():
108 diskdata["Start"+key] = str(int(olddiskdata[key])) 108 diskdata["Start"+key] = str(int(olddiskdata[key]))
109 diskdata["End"+key] = str(int(newdiskdata[key])) 109 diskdata["End"+key] = str(int(newdiskdata[key]))
110 return diskdata 110 return diskdata
111 111
112def set_timedata(var, data, server_time=None): 112def set_timedata(var, data, server_time=None):
113 import time 113 import time
114 if server_time: 114 if server_time:
@@ -137,7 +137,7 @@ def get_timedata(var, data, server_time=None):
137 else: 137 else:
138 cpuperc = None 138 cpuperc = None
139 return timediff, cpuperc 139 return timediff, cpuperc
140 140
141def write_task_data(status, logfile, dev, e): 141def write_task_data(status, logfile, dev, e):
142 bn = get_bn(e) 142 bn = get_bn(e)
143 bsdir = os.path.join(e.data.getVar('BUILDSTATS_BASE', True), bn) 143 bsdir = os.path.join(e.data.getVar('BUILDSTATS_BASE', True), bn)
@@ -164,7 +164,7 @@ def write_task_data(status, logfile, dev, e):
164 for key in sorted(diskdata.iterkeys()): 164 for key in sorted(diskdata.iterkeys()):
165 file.write(key + ": " + diskdata[key] + "\n") 165 file.write(key + ": " + diskdata[key] + "\n")
166 if status is "passed": 166 if status is "passed":
167 file.write("Status: PASSED \n") 167 file.write("Status: PASSED \n")
168 else: 168 else:
169 file.write("Status: FAILED \n") 169 file.write("Status: FAILED \n")
170 file.write("Ended: %0.2f \n" % e.time) 170 file.write("Ended: %0.2f \n" % e.time)
@@ -189,7 +189,7 @@ python run_buildstats () {
189 bn = get_bn(e) 189 bn = get_bn(e)
190 set_device(e) 190 set_device(e)
191 device = get_device(e) 191 device = get_device(e)
192 192
193 bsdir = os.path.join(e.data.getVar('BUILDSTATS_BASE', True), bn) 193 bsdir = os.path.join(e.data.getVar('BUILDSTATS_BASE', True), bn)
194 try: 194 try:
195 bb.utils.mkdirhier(bsdir) 195 bb.utils.mkdirhier(bsdir)
@@ -209,7 +209,7 @@ python run_buildstats () {
209 file.write("\n") 209 file.write("\n")
210 file.write("Build Started: %0.2f \n" % time.time()) 210 file.write("Build Started: %0.2f \n" % time.time())
211 file.close() 211 file.close()
212 212
213 elif isinstance(e, bb.event.BuildCompleted): 213 elif isinstance(e, bb.event.BuildCompleted):
214 bn = get_bn(e) 214 bn = get_bn(e)
215 device = get_device(e) 215 device = get_device(e)
@@ -260,10 +260,10 @@ python run_buildstats () {
260 write_task_data("passed", os.path.join(taskdir, e.task), device, e) 260 write_task_data("passed", os.path.join(taskdir, e.task), device, e)
261 if e.task == "do_rootfs": 261 if e.task == "do_rootfs":
262 bsdir = os.path.join(e.data.getVar('BUILDSTATS_BASE', True), bn) 262 bsdir = os.path.join(e.data.getVar('BUILDSTATS_BASE', True), bn)
263 bs=os.path.join(bsdir, "build_stats") 263 bs = os.path.join(bsdir, "build_stats")
264 file = open(bs,"a") 264 file = open(bs,"a")
265 rootfs = e.data.getVar('IMAGE_ROOTFS', True) 265 rootfs = e.data.getVar('IMAGE_ROOTFS', True)
266 rootfs_size = subprocess.Popen(["du", "-sh", rootfs], stdout=subprocess.PIPE).stdout.read() 266 rootfs_size = subprocess.Popen(["du", "-sh", rootfs], stdout=subprocess.PIPE).stdout.read()
267 file.write("Uncompressed Rootfs size: %s" % rootfs_size) 267 file.write("Uncompressed Rootfs size: %s" % rootfs_size)
268 file.close() 268 file.close()
269 269
@@ -274,8 +274,8 @@ python run_buildstats () {
274 taskdir = os.path.join(bsdir, e.data.expand("${PF}")) 274 taskdir = os.path.join(bsdir, e.data.expand("${PF}"))
275 write_task_data("failed", os.path.join(taskdir, e.task), device, e) 275 write_task_data("failed", os.path.join(taskdir, e.task), device, e)
276 ######################################################################## 276 ########################################################################
277 # Lets make things easier and tell people where the build failed in 277 # Lets make things easier and tell people where the build failed in
278 # build_status. We do this here because BuildCompleted triggers no 278 # build_status. We do this here because BuildCompleted triggers no
279 # matter what the status of the build actually is 279 # matter what the status of the build actually is
280 ######################################################################## 280 ########################################################################
281 build_status = os.path.join(bsdir, "build_stats") 281 build_status = os.path.join(bsdir, "build_stats")