<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>5485</bug_id>
          
          <creation_ts>2013-11-06 12:16:59 +0000</creation_ts>
          <short_desc>Buildstats info and database entries doesn&apos;t match sometimes</short_desc>
          <delta_ts>2015-03-23 09:29:23 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>Toaster</product>
          <component>toaster</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.6 M1</target_milestone>
          
          <blocked>5300</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Andreea Brandusa Proca">andreea.b.proca</reporter>
          <assigned_to name="Marius Avram">marius.avram</assigned_to>
          <cc>alexandru.c.georgescu</cc>
    
    <cc>alexandru.damian</cc>
    
    <cc>belen.barros.pena</cc>
    
    <cc>cristiana.voicu</cc>
    
    <cc>ionutx.chisanovici</cc>
    
    <cc>sgw</cc>
          
          <qa_contact name="Mihail Stanciu">stanciux.mihail</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>38579</commentid>
    <comment_count>0</comment_count>
    <who name="Andreea Brandusa Proca">andreea.b.proca</who>
    <bug_when>2013-11-06 12:16:59 +0000</bug_when>
    <thetext>The stats file:   
/home/brandusa/dora-toaster/build/tmp/buildstats/core-image-sato-qemux86/201311051554/expat-native-2.1.0-r0/do_fetch.
Part of the stats file content:
        Event: TaskStarted.
        Started: 1383660092.00.
        expat-native-2.1.0-r0: do_fetch: Elapsed time: 0.01 seconds.
        CPU usage: 11.1%.
        EndTimeIO: 297560
        StartTimeIO: 297548

In database: 
 {
        &quot;pk&quot;: 4119,
        &quot;model&quot;: &quot;orm.task&quot;,
        &quot;fields&quot;: {
            &quot;work_directory&quot;: &quot;&quot;,
            &quot;cpu_usage&quot;: &quot;0.1&quot;,
            &quot;task_executed&quot;: true,
            &quot;disk_io&quot;: 1688,
            &quot;line_number&quot;: 0,
            &quot;path_to_sstate_obj&quot;: &quot;&quot;,
            &quot;sstate_checksum&quot;: &quot;02efd1cf3485aa9c44e768e8b84f0461&quot;,
            &quot;recipe&quot;: 184,
            &quot;sstate_result&quot;: 0,
            &quot;source_url&quot;: &quot;&quot;,
            &quot;elapsed_time&quot;: &quot;2.170456&quot;,
            &quot;logfile&quot;: &quot;/home/brandusa/dora-toaster/build/tmp/work/x86_64-linux/expat-native/2.1.0-r0/temp/log.do_fetch.4324&quot;,
            &quot;build&quot;: 1,
            &quot;task_name&quot;: &quot;do_fetch&quot;,
            &quot;message&quot;: &quot;recipe expat-native-2.1.0-r0: task do_fetch: Succeeded&quot;,
            &quot;outcome&quot;: 0,
            &quot;order&quot;: 347,
            &quot;script_type&quot;: 1
        }
F
======================================================================
FAIL: test_quality_Task (orm.tests.WebHobTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File &quot;/home/brandusa/dora-toaster/bitbake/lib/toaster/orm/tests.py&quot;, line 424, in test_quality_Task
    self.assertEqual(disk_io, float(task_values[i][&quot;disk_io&quot;]))
AssertionError: 12.0 != 1688.0</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>39185</commentid>
    <comment_count>1</comment_count>
    <who name="Alexandru Damian">alexandru.damian</who>
    <bug_when>2013-12-02 14:06:20 +0000</bug_when>
    <thetext>In review poky-contrib: toaster/master. 
Buildstats gathering mechanism is changed, the race condition that may have happened here is no longer possible.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>39619</commentid>
    <comment_count>2</comment_count>
    <who name="Alexandru Damian">alexandru.damian</who>
    <bug_when>2013-12-30 13:29:16 +0000</bug_when>
    <thetext>merged in origin/master:f8120984f459d193ce5ffa243137baf0e38d223e</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>39800</commentid>
    <comment_count>3</comment_count>
    <who name="Andreea Brandusa Proca">andreea.b.proca</who>
    <bug_when>2014-01-14 13:37:53 +0000</bug_when>
    <thetext>Stats file:
Event: TaskStarted.
Started: 1389700513.32.
core-image-minimal-1.0-r0: do_populate_lic_setscene: Elapsed time: 0.49 seconds.
Ended: 1389700513.81

In database:
&quot;pk&quot;: 1636,.
    &quot;model&quot;: &quot;orm.task&quot;,.
    &quot;fields&quot;: {
        &quot;work_directory&quot;: &quot;&quot;,.
        &quot;cpu_usage&quot;: &quot;1.3&quot;,.
        &quot;task_executed&quot;: true,.
        &quot;disk_io&quot;: 488,.
        &quot;line_number&quot;: 0,.
        &quot;path_to_sstate_obj&quot;: &quot;&quot;,.
        &quot;sstate_checksum&quot;: &quot;769dca759ea690036d40caee0627ae7a&quot;,.
        &quot;recipe&quot;: 100,.
        &quot;sstate_result&quot;: 0,.
        &quot;source_url&quot;: &quot;&quot;,.
        &quot;elapsed_time&quot;: &quot;0.160532&quot;,.
        &quot;logfile&quot;: &quot;/home/andreea/poky/build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/temp/log.do_populate_lic_setscene.5748&quot;,.
        &quot;build&quot;: 1,.
        &quot;task_name&quot;: &quot;do_populate_lic_setscene&quot;,.
        &quot;message&quot;: &quot;recipe core-image-minimal-1.0-r0: task do_populate_lic_setscene: Succeeded&quot;,.
        &quot;outcome&quot;: 0,.
        &quot;order&quot;: 1,.
        &quot;script_type&quot;: 2
    }


Test result:
FAIL: test_quality_Task (orm.tests.QualityTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File &quot;/home/andreea/poky/bitbake/lib/toaster/orm/tests.py&quot;, line 121, in test_quality_Task
    self.assertEqual(elapsed_time, float(task_values[i][&quot;elapsed_time&quot;]))
AssertionError: 0.49 != 0.160532

master:1b636173ca88e5ccca1992f9a12367a1189fa674</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>40448</commentid>
    <comment_count>4</comment_count>
    <who name="Marius Avram">marius.avram</who>
    <bug_when>2014-02-19 10:03:01 +0000</bug_when>
    <thetext>I submitted a fix for the problem on the bitbake-devel@lists.openembedded.org mailing list, commit 3c9f2e6a0506700e661e53e21309b0f74897e2d2.

As I mentioned in the commit message, the main problem is that BuildInfoHelper class was measuring separately the time for a task at the arrival of the events. Also that the task was measured between different events in buildstats and toaster. This was one of the causes for the mismatch. Another problem is that the storing of the dependency information takes about 20 seconds. This was shortened to about 10 seconds in commit 24119541fc14c64342f65e92c6efd3da08c9b930. But it was not enough for the desired accuracy.

The solution includes a time member in the TaskBase class, which is initialized at creation time. This brings similar time between buildstat and toaster.

Because buildstats is still measuring time separately I suggest to modify it to use the newly added member from TaskBase (after the current patches are merged). This will remove any other possible inconsistencies between times.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>40467</commentid>
    <comment_count>5</comment_count>
    <who name="Alexandru Damian">alexandru.damian</who>
    <bug_when>2014-02-19 18:47:42 +0000</bug_when>
    <thetext>Can you please rebase on the latest toaster/master ?

The event handling code changed slightly, so it needs rebaseing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>41690</commentid>
    <comment_count>6</comment_count>
    <who name="Marius Avram">marius.avram</who>
    <bug_when>2014-03-25 13:25:38 +0000</bug_when>
    <thetext>Solution merged to master:poky patches: f191ab0198e383cda37b0bfdfb6365d85499e36b and ba6caa021fea2edc5483bcde6d71122f2a2a871a</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>42223</commentid>
    <comment_count>7</comment_count>
    <who name="Ionut Chisanovici">ionutx.chisanovici</who>
    <bug_when>2014-04-03 13:29:25 +0000</bug_when>
    <thetext>Verified.

Ionut C</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>47067</commentid>
    <comment_count>8</comment_count>
    <who name="Ionut Chisanovici">ionutx.chisanovici</who>
    <bug_when>2014-11-18 08:20:51 +0000</bug_when>
    <thetext>Hi guys,

For 1.6.2 rc2, commit: 30b8d9378b8260e452552b806610dc9b6fe0b69f, the issue is not fixed.

In database: 

sqlite&gt; select cpu_usage from orm_task where id=675;
cpu_usage = 6.1

In stats file:

$ cat core-image-sato-qemux86/201411171101/ncurses-native-5.9-r15.1/do_patch | grep CPU
CPU usage: 2.0% 

Cheers,
Ionut C</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>47073</commentid>
    <comment_count>9</comment_count>
    <who name="Alexandru Damian">alexandru.damian</who>
    <bug_when>2014-11-18 10:18:54 +0000</bug_when>
    <thetext>Will not fix for 1.6.x series, master patches can&apos;t be easily backported.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>49636</commentid>
    <comment_count>10</comment_count>
    <who name="Alexandru Georgescu">alexandru.c.georgescu</who>
    <bug_when>2015-03-23 09:29:23 +0000</bug_when>
    <thetext>Verified as per above comments.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>