octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #65595] profile on does not clear old profilin


From: Lars Kindermann
Subject: [Octave-bug-tracker] [bug #65595] profile on does not clear old profiling data
Date: Mon, 15 Apr 2024 01:07:23 -0400 (EDT)

URL:
  <https://savannah.gnu.org/bugs/?65595>

                 Summary: profile on does not clear old profiling data
                   Group: GNU Octave
               Submitter: larskindermann
               Submitted: Mon 15 Apr 2024 07:07:23 AM CEST
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: dev
         Discussion Lock: Any
        Operating System: GNU/Linux
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Mon 15 Apr 2024 07:07:23 AM CEST By: Lars Kindermann <larskindermann>
"profile on" does not clear old profiling data as described in the docs. 
You currently have to use "profile clear" in addition as a workaround:

>> profile clear;

>> profile on; log(1:100000000); profile off; profshow (1)
   # Function Attr     Time (s)   Time (%)        Calls
-------------------------------------------------------
   1      log             3.940     100.00            1

>> profile on; log(1:100000000); profile off; profshow (1)
   # Function Attr     Time (s)   Time (%)        Calls
-------------------------------------------------------
   1      log             7.133     100.00            2

>> profile on; log(1:100000000); profile off; profshow (1)
   # Function Attr     Time (s)   Time (%)        Calls
-------------------------------------------------------
   1      log            10.478     100.00            3

>> profile clear; 

>> profile on; log(1:100000000); profile off; profshow (1)
   # Function Attr     Time (s)   Time (%)        Calls
-------------------------------------------------------
   1      log             3.124     100.00            1


Reason: In profile.m both cases for "on" and "resume" are handled
identically:

switch (arg)
    case "on"
      __profiler_enable__ (true);

    case "off"
      __profiler_enable__ (false);

    case "clear"
      __profiler_reset__ ();

    case "resume"
      __profiler_enable__ (true);


Fix: Simply change the "on" case in profile.m if you don't want to touch the C
code:

    case "on"
      if __profiler_enable__ ()
        __profiler_enable__ (false);
      endif
      __profiler_reset__ ();
      __profiler_enable__ (true);









    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?65595>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]