emacs-diffs
[Top][All Lists]
Advanced

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

master b19ec1be3c 3/5: %CPU can exceed 100 on GNU/Linux


From: Paul Eggert
Subject: master b19ec1be3c 3/5: %CPU can exceed 100 on GNU/Linux
Date: Fri, 4 Mar 2022 22:29:24 -0500 (EST)

branch: master
commit b19ec1be3c35b0ec231282ab51d0b320e2967052
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>

    %CPU can exceed 100 on GNU/Linux
    
    * src/sysdep.c (system_process_attributes) [GNU_LINUX]:
    CPU usage can exceed 100% on a multicore platform when Emacs is
    not entirely single-threaded.
---
 doc/lispref/processes.texi | 5 +++--
 src/sysdep.c               | 2 --
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index d338d59a81..ed07c1cbf7 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -2382,8 +2382,9 @@ occupied by the process in the machine's physical memory.
 
 @item pcpu
 The percentage of the CPU time used by the process since it started.
-The corresponding @var{value} is a floating-point number between 0 and
-100.
+The corresponding @var{value} is a nonnegative floating-point number.
+Although in theory the number can exceed 100 on a multicore platform,
+it is usually less than 100 because Emacs is typically single-threaded.
 
 @item pmem
 The percentage of the total physical memory installed on the machine
diff --git a/src/sysdep.c b/src/sysdep.c
index 28d32c77c6..c9101f9481 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -3487,8 +3487,6 @@ system_process_attributes (Lisp_Object pid)
          attrs = Fcons (Fcons (Qetime, make_lisp_time (telapsed)), attrs);
          us_time = time_from_jiffies (u_time + s_time, clocks_per_sec);
          pcpu = timespectod (us_time) / timespectod (telapsed);
-         if (pcpu > 1.0)
-           pcpu = 1.0;
          attrs = Fcons (Fcons (Qpcpu, make_float (100 * pcpu)), attrs);
          pmem = 4.0 * 100 * rss / procfs_get_total_memory ();
          if (pmem > 100)



reply via email to

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