Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Saul Wold <sgw@linux.intel.com>
To: Alex DAMIAN <alexandru.damian@intel.com>,
	 openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 3/3] buildstats: use TaskBase time for elapsed time
Date: Tue, 18 Mar 2014 15:28:48 -0700	[thread overview]
Message-ID: <5328C8A0.1010100@linux.intel.com> (raw)
In-Reply-To: <6f3acb92219b832f847d4e59342c8c4582ac5b78.1395068545.git.alexandru.damian@intel.com>

On 03/17/2014 08:04 AM, Alex DAMIAN wrote:
> From: Marius Avram <marius.avram@intel.com>
>
> To avoid any further inconsistencies between buildstats and buildinfohelper
> from toaster, buildstats will measure task duration using the time field
> from within the TaskBase events: TaskStarted and TaskSucceeded/TaskFailed.
>

This patch seems to be causing some problems:

> ERROR: Execution of event handler 'run_buildstats' failed
> Traceback (most recent call last):
>   File "run_buildstats(e)", line 72, in run_buildstats(e=<bb.build.TaskStarted object at 0x6e45590>)
> AttributeError: 'TaskStarted' object has no attribute 'time'
>
> ERROR: Execution of event handler 'run_buildstats' failed
> Traceback (most recent call last):
>   File "run_buildstats(e)", line 88, in run_buildstats(e=<bb.build.TaskSucceeded object at 0x6e40190>)
>   File "buildstats.bbclass", line 5, in write_task_data(status='passed', logfile='/home/sgw/yocto/builds/world/tmp/buildstats/linux-yocto-qemux86-64/201403181525/linux-yocto-3.10.32+gitAUTOINC+7b3b87d4d5_78afd3095c-r0/do_clean', dev='sda5', e=<bb.build.TaskSucceeded object at 0x6e40190>)
> IOError: [Errno 2] No such file or directory: '/home/sgw/yocto/builds/world/tmp/buildstats/linux-yocto-qemux86-64/201403181525/linux-yocto-3.10.32+gitAUTOINC+7b3b87d4d5_78afd3095c-r0/do_clean'
>
> ERROR: Execution of event handler 'run_buildstats' failed
> Traceback (most recent call last):
>   File "run_buildstats(e)", line 72, in run_buildstats(e=<bb.build.TaskStarted object at 0x74f59d0>)
> AttributeError: 'TaskStarted' object has no attribute 'time'
>
> ERROR: Execution of event handler 'run_buildstats' failed
> Traceback (most recent call last):
>   File "run_buildstats(e)", line 88, in run_buildstats(e=<bb.build.TaskSucceeded object at 0x6e48dd0>)
>   File "buildstats.bbclass", line 5, in write_task_data(status='passed', logfile='/home/sgw/yocto/builds/world/tmp/buildstats/linux-yocto-qemux86-64/201403181525/linux-yocto-3.10.32+gitAUTOINC+7b3b87d4d5_78afd3095c-r0/do_cleansstate', dev='sda5', e=<bb.build.TaskSucceeded object at 0x6e48dd0>)



Sau!


> Signed-off-by: Marius Avram <marius.avram@intel.com>
> ---
>   meta/classes/buildstats.bbclass | 23 +++++++++++++++--------
>   1 file changed, 15 insertions(+), 8 deletions(-)
>
> diff --git a/meta/classes/buildstats.bbclass b/meta/classes/buildstats.bbclass
> index 72fff11..89ae72c 100644
> --- a/meta/classes/buildstats.bbclass
> +++ b/meta/classes/buildstats.bbclass
> @@ -109,14 +109,17 @@ def get_diskdata(var, dev, data):
>           diskdata["End"+key] = str(int(newdiskdata[key]))
>       return diskdata
>
> -def set_timedata(var, data):
> +def set_timedata(var, data, server_time=None):
>       import time
> -    time = time.time()
> +    if server_time:
> +        time = server_time
> +    else:
> +        time = time.time()
>       cputime = get_cputime()
>       proctime = get_process_cputime(os.getpid())
>       data.setVar(var, (time, cputime, proctime))
>
> -def get_timedata(var, data):
> +def get_timedata(var, data, server_time=None):
>       import time
>       timedata = data.getVar(var, False)
>       if timedata is None:
> @@ -124,7 +127,11 @@ def get_timedata(var, data):
>       oldtime, oldcpu, oldproc = timedata
>       procdiff = get_process_cputime(os.getpid()) - oldproc
>       cpudiff = get_cputime() - oldcpu
> -    timediff = time.time() - oldtime
> +    if server_time:
> +        end_time = server_time
> +    else:
> +        end_time = time.time()
> +    timediff = end_time - oldtime
>       if cpudiff > 0:
>           cpuperc = float(procdiff) * 100 / cpudiff
>       else:
> @@ -136,7 +143,7 @@ def write_task_data(status, logfile, dev, e):
>       bsdir = os.path.join(e.data.getVar('BUILDSTATS_BASE', True), bn)
>       taskdir = os.path.join(bsdir, e.data.expand("${PF}"))
>       file = open(os.path.join(logfile), "a")
> -    timedata = get_timedata("__timedata_task", e.data)
> +    timedata = get_timedata("__timedata_task", e.data, e.time)
>       if timedata:
>           elapsedtime, cpu = timedata
>           file.write(bb.data.expand("${PF}: %s: Elapsed time: %0.2f seconds \n" %
> @@ -160,7 +167,7 @@ def write_task_data(status, logfile, dev, e):
>   	    file.write("Status: PASSED \n")
>       else:
>           file.write("Status: FAILED \n")
> -    file.write("Ended: %0.2f \n" % time.time())
> +    file.write("Ended: %0.2f \n" % e.time)
>       file.close()
>
>   python run_buildstats () {
> @@ -234,7 +241,7 @@ python run_buildstats () {
>           taskdir = os.path.join(bsdir, e.data.expand("${PF}"))
>           if device != "NoLogicalDevice":
>               set_diskdata("__diskdata_task", device, e.data)
> -        set_timedata("__timedata_task", e.data)
> +        set_timedata("__timedata_task", e.data, e.time)
>           try:
>               bb.utils.mkdirhier(taskdir)
>           except:
> @@ -242,7 +249,7 @@ python run_buildstats () {
>           # write into the task event file the name and start time
>           file = open(os.path.join(taskdir, e.task), "a")
>           file.write("Event: %s \n" % bb.event.getName(e))
> -        file.write("Started: %0.2f \n" % time.time())
> +        file.write("Started: %0.2f \n" % e.time)
>           file.close()
>
>       elif isinstance(e, bb.build.TaskSucceeded):
>


  reply	other threads:[~2014-03-18 22:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-17 15:04 [PATCH 0/3] toaster-related patchset Alex DAMIAN
2014-03-17 15:04 ` [PATCH 1/3] toaster.bbclass: read the data needed for license manifest path Alex DAMIAN
2014-03-17 15:04 ` [PATCH 2/3] sstate: list missing files for toaster Alex DAMIAN
2014-03-17 15:04 ` [PATCH 3/3] buildstats: use TaskBase time for elapsed time Alex DAMIAN
2014-03-18 22:28   ` Saul Wold [this message]
2014-03-18 23:15     ` Richard Purdie
2014-03-19  9:34       ` Damian, Alexandru

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5328C8A0.1010100@linux.intel.com \
    --to=sgw@linux.intel.com \
    --cc=alexandru.damian@intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox