Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Saul Wold <saul.wold@intel.com>
To: Patches and discussions about the oe-core layer
	<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 1/1] [Yocto Bug 1700] Fix for buildstats on tmpfs
Date: Mon, 07 Nov 2011 09:50:45 -0800	[thread overview]
Message-ID: <4EB81A75.1070709@intel.com> (raw)
In-Reply-To: <ac412c93c681ef335970a678465aa015164f1015.1320190748.git.elizabeth.flanagan@intel.com>

On 11/01/2011 11:41 PM, Beth Flanagan wrote:
> From: Elizabeth Flanagan<elizabeth.flanagan@intel.com>
>
> tmpfs/encryptfs/(and most likely, but not confirmed)ramfs TMPDIRs
> cause diskstats to choke. No device entry ends up in /proc/diskstats
> for these fs types, which ends up causing the failure.
>
> The short term solution is to exclude these fs types from diskstat
> collection. Longer term we will want to see if we can collect
> meaningful diskio for each of these, and other, use cases, but for
> this cleans up Bug 1700.
>
> Signed-off-by: Elizabeth Flanagan<elizabeth.flanagan@intel.com>
> ---
>   meta/classes/buildstats.bbclass |   37 ++++++++++++++++++++++++++-----------
>   1 files changed, 26 insertions(+), 11 deletions(-)
>
> diff --git a/meta/classes/buildstats.bbclass b/meta/classes/buildstats.bbclass
> index 55cbb3c..96c98d4 100644
> --- a/meta/classes/buildstats.bbclass
> +++ b/meta/classes/buildstats.bbclass
> @@ -48,13 +48,24 @@ def set_device(e):
>       # something like stick DL_DIR on a different partition and this would
>       # throw stats gathering off. The same goes with SSTATE_DIR. However, let's
>       # get the basics in here and work on the cornercases later.
> +    # A note. /proc/diskstats does not contain info on encryptfs, tmpfs, etc.
> +    # If we end up hitting one of these fs, we'll just skip diskstats collection.
>       ############################################################################
>       device=os.stat(tmpdir)
>       majordev=os.major(device.st_dev)
>       minordev=os.minor(device.st_dev)
> +    ############################################################################
> +    # Bug 1700:
> +    # Because tmpfs/encryptfs/ramfs etc inserts no entry in /proc/diskstats
> +    # we set rdev to NoLogicalDevice and search for it later. If we find NLD
> +    # we do not collect diskstats as the method to collect meaningful statistics
> +    # for these fs types requires a bit more research.
> +    ############################################################################
>       for line in open("/proc/diskstats", "r"):
>           if majordev == int(line.split()[0]) and minordev == int(line.split()[1]):
>              rdev=line.split()[2]
> +        else:
> +           rdev="NoLogicalDevice"
>       file = open(bb.data.getVar('DEVFILE', e.data, True), "w")
>       file.write(rdev)
>       file.close()
> @@ -133,10 +144,11 @@ def write_task_data(status, logfile, dev, e):
>       # For the best information, running things with BB_TOTAL_THREADS = "1"
>       # would return accurate per task results.
>       ############################################################################
> -    diskdata = get_diskdata("__diskdata_task", dev, e.data)
> -    if diskdata:
> -        for key in sorted(diskdata.iterkeys()):
> -            file.write(key + ": " + diskdata[key] + "\n")
> +    if dev != "NoLogicalDevice":
> +        diskdata = get_diskdata("__diskdata_task", dev, e.data)
> +        if diskdata:
> +            for key in sorted(diskdata.iterkeys()):
> +                file.write(key + ": " + diskdata[key] + "\n")
>       if status is "passed":
>   	    file.write("Status: PASSED \n")
>       else:
> @@ -169,7 +181,8 @@ python run_buildstats () {
>               bb.mkdirhier(bsdir)
>           except:
>               pass
> -        set_diskdata("__diskdata_build", device, e.data)
> +        if device != "NoLogicalDevice":
> +            set_diskdata("__diskdata_build", device, e.data)
>           set_timedata("__timedata_build", e.data)
>           build_time = os.path.join(bsdir, "build_stats")
>           # write start of build into build_time
> @@ -185,7 +198,7 @@ python run_buildstats () {
>
>       elif isinstance(e, bb.event.BuildCompleted):
>           bn = get_bn(e)
> -        dev = get_device(e)
> +        device = get_device(e)
>           bsdir = os.path.join(bb.data.getVar('BUILDSTATS_BASE', e.data, True), bn)
>           taskdir = os.path.join(bsdir, bb.data.expand("${PF}", e.data))
>           build_time = os.path.join(bsdir, "build_stats")
> @@ -201,10 +214,11 @@ python run_buildstats () {
>               file.write("Elapsed time: %0.2f seconds \n" % (time))
>               if cpu:
>                   file.write("CPU usage: %0.1f%% \n" % cpu)
> -        diskio = get_diskdata("__diskdata_build", dev, e.data)
> -        if diskio:
> -            for key in sorted(diskio.iterkeys()):
> -                file.write(key + ": " + diskio[key] + "\n")
> +        if device != "NoLogicalDevice":
> +            diskio = get_diskdata("__diskdata_build", device, e.data)
> +            if diskio:
> +                for key in sorted(diskio.iterkeys()):
> +                    file.write(key + ": " + diskio[key] + "\n")
>           file.close()
>
>       if isinstance(e, bb.build.TaskStarted):
> @@ -212,7 +226,8 @@ python run_buildstats () {
>           device = get_device(e)
>           bsdir = os.path.join(bb.data.getVar('BUILDSTATS_BASE', e.data, True), bn)
>           taskdir = os.path.join(bsdir, bb.data.expand("${PF}", e.data))
> -        set_diskdata("__diskdata_task", device, e.data)
> +        if device != "NoLogicalDevice":
> +            set_diskdata("__diskdata_task", device, e.data)
>           set_timedata("__timedata_task", e.data)
>           try:
>               bb.mkdirhier(taskdir)

Merged into OE-Core with minor tweak to fix commit message formating

Thanks
	Sau!




  reply	other threads:[~2011-11-07 17:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-02  6:41 [PATCH 0/1] [Yocto Bug 1700] Fix for buildstats diskio on non physical disks Beth Flanagan
2011-11-02  6:41 ` [PATCH 1/1] [Yocto Bug 1700] Fix for buildstats on tmpfs Beth Flanagan
2011-11-07 17:50   ` Saul Wold [this message]
2011-11-08 10:15 ` [PATCH 0/1] [Yocto Bug 1700] Fix for buildstats diskio on non physical disks Wolfram Stering
2011-11-08 14:12   ` Richard Purdie
2011-11-08 15:53     ` Wolfram Stering
2011-11-08 15:57       ` Flanagan, Elizabeth
2011-11-09 12:00         ` Wolfram Stering
2011-11-09 18:11           ` Flanagan, Elizabeth
2011-11-09 12:13         ` Koen Kooi
2011-11-09 18:21           ` Flanagan, Elizabeth

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=4EB81A75.1070709@intel.com \
    --to=saul.wold@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