[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#22114: 24.5; [PATCH] Allow profiler.el to display reports after stop
From: |
Eli Zaretskii |
Subject: |
bug#22114: 24.5; [PATCH] Allow profiler.el to display reports after stopping |
Date: |
Tue, 08 Dec 2015 18:22:47 +0200 |
> Date: Tue, 8 Dec 2015 09:13:58 +0100
> From: Vasilij Schneidermann <v.schneidermann@gmail.com>
>
> I've worked with a few other profilers than profiler.el so far and one
> striking difference is that they allowed you to start a profiling run,
> stop it and then retrieve the profiling log between these two points in
> time. profiler.el on the other hand flatout refuses to display a report
> after stopping which is especially puzzling given the `profiler-stop`
> docstring: "Stop started profilers. Profiler logs will be kept." If
> the logs are kept after all, why can't I take a look at them?
>
> I've attached a patch that solves this by caching the last accessable
> profiler log. This allows both workflows to work, be it displaying a
> report while the profiler is still running or displaying it after
> stopping the profiler.
Thanks. But I don't see why we would need to keep a copy of the
profile around (and it looks weird to do that anyway, when we have a
function that reports it). When profiler-cpu-log is called, it
returns the profile before it resets it, so the data is available and
should simply be used.
I don't really understand why profiler.el insists on having the
profiler running for providing the profile. The much simpler patch
below makes it possible for me to invoke profiler-report whether a
profile is running or not. Does it work for you? If not, can you
tell what I missed?
--- lisp/profiler.el~4 2015-11-11 07:57:32.000000000 +0200
+++ lisp/profiler.el 2015-12-08 17:54:27.380084700 +0200
@@ -216,19 +216,17 @@
(defun profiler-cpu-profile ()
"Return CPU profile."
- (when (profiler-running-p 'cpu)
- (profiler-make-profile
- :type 'cpu
- :timestamp (current-time)
- :log (profiler-cpu-log))))
+ (profiler-make-profile
+ :type 'cpu
+ :timestamp (current-time)
+ :log (profiler-cpu-log)))
(defun profiler-memory-profile ()
"Return memory profile."
- (when (profiler-memory-running-p)
- (profiler-make-profile
- :type 'memory
- :timestamp (current-time)
- :log (profiler-memory-log))))
+ (profiler-make-profile
+ :type 'memory
+ :timestamp (current-time)
+ :log (profiler-memory-log)))
;;; Calltrees
@@ -846,12 +844,12 @@
(defun profiler-report-cpu ()
(let ((profile (profiler-cpu-profile)))
- (when profile
+ (when (and profile (profiler-profile-log profile))
(profiler-report-profile-other-window profile))))
(defun profiler-report-memory ()
(let ((profile (profiler-memory-profile)))
- (when profile
+ (when (and profile (profiler-profile-log profile))
(profiler-report-profile-other-window profile))))
(defun profiler-report ()
- bug#22114: 24.5; [PATCH] Allow profiler.el to display reports after stopping, Vasilij Schneidermann, 2015/12/08
- bug#22114: 24.5; [PATCH] Allow profiler.el to display reports after stopping,
Eli Zaretskii <=
- bug#22114: 24.5; [PATCH] Allow profiler.el to display reports after stopping, Vasilij Schneidermann, 2015/12/08
- bug#22114: 24.5; [PATCH] Allow profiler.el to display reports after stopping, Eli Zaretskii, 2015/12/08
- bug#22114: 24.5; [PATCH] Allow profiler.el to display reports after stopping, John Wiegley, 2015/12/08
- bug#22114: 24.5; [PATCH] Allow profiler.el to display reports after stopping, Vasilij Schneidermann, 2015/12/08
- bug#22114: 24.5; [PATCH] Allow profiler.el to display reports after stopping, John Wiegley, 2015/12/08
- bug#22114: 24.5; [PATCH] Allow profiler.el to display reports after stopping, Vasilij Schneidermann, 2015/12/08
- bug#22114: 24.5; [PATCH] Allow profiler.el to display reports after stopping, Eli Zaretskii, 2015/12/08
- bug#22114: 24.5; [PATCH] Allow profiler.el to display reports after stopping, John Wiegley, 2015/12/08
- bug#22114: 24.5; [PATCH] Allow profiler.el to display reports after stopping, Vasilij Schneidermann, 2015/12/10
- bug#22114: 24.5; [PATCH] Allow profiler.el to display reports after stopping, Vasilij Schneidermann, 2015/12/13