<?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>15015</bug_id>
          
          <creation_ts>2023-01-25 08:41:22 +0000</creation_ts>
          <short_desc>Bitbake UI reports incorrect task elapsed time after suspend</short_desc>
          <delta_ts>2023-01-26 15:37:15 +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>BitBake</product>
          <component>bitbake</component>
          <version>4.2</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Undecided</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Opdenacker">michael.opdenacker</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>ross.burton</cc>
          
          
          <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>94791</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Opdenacker">michael.opdenacker</who>
    <bug_when>2023-01-25 08:41:22 +0000</bug_when>
    <thetext>If, during an OpenEmbedded build, the system running BitBake is suspended to RAM, the reported task elapsed times are wrong at resume time. They reflect the difference between current time of day and the time of day the task was started. Instead, I would expect the actual task duration when the system is up:

Currently  4 running tasks (594 of 2884)  20% |####################
0: binutils-cross-x86_64-2.39-r0 do_compile - 12h9m19s (pid 12585)
1: perl-native-5.36.0-r0 do_compile - 12h5m4s (pid 247433)
2: libunistring-native-1.1-r0 do_configure - 38s (pid 274857)
3: libgpg-error-native-1.46-r0 do_configure - 17s (pid 280777)

At least this applies to long enough tasks which were started before the system was suspended.

This should be solved if BitBake compare time using a monotonic clock instead, like by using clock.monotonic().</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94794</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2023-01-25 17:17:44 +0000</bug_when>
    <thetext>I&apos;m not entirely convinced this is a bug. I saw your patch changing the UI code to use time.monotonic() instead of time.time(). 

My worries include:

a) in the code it is documented as &quot;start time&quot; which it no longer is
b) whether we change all places where this is compared to monotonic?
c) there is wide use of time.time() elsewhere in bitbake so we can no longer easily compare timestamps
d) you can&apos;t really compare time.monotonic() between processes and we do have multiple processes involved in bitbake

I&apos;d think suspend to RAM in the middle of a build is a relatively rare case and I&apos;m not sure we want to take the risk and complication from trying to change this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94795</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2023-01-25 17:27:29 +0000</bug_when>
    <thetext>I mostly agree with RP.  It would be nice for the durations to not include time asleep, but that would involve a wholescale review of every timestamp to understand if its a monotonic clock or wall clock.

That&apos;s a non-trivial amount of effort for a very niche usecase, IMHO.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94796</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Opdenacker">michael.opdenacker</who>
    <bug_when>2023-01-25 17:35:27 +0000</bug_when>
    <thetext>Understood, no problem.
I actually suspend my laptop every time I leave it (unless I have an urgent job to complete). This saves a lot a power!
However, I agree this corresponds to a niche case and people are not likely to complain about this minor issue.
I just hoped my patch only impacted the task duration in the UI, but you know better what the side effects may be.
Don&apos;t hesitate to close it as &quot;WON&apos;T FIX&quot;. It seems I can&apos;t.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94809</commentid>
    <comment_count>4</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-01-26 15:37:15 +0000</bug_when>
    <thetext>As per discussion above.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>