Could you explain more about "user CPU time" and "system CPU time"? I have read a lot, but I couldn't understand it well.
-
2possible duplicate of [What specifically are wall-clock-time, user-cpu-time, and system-cpu-time in UNIX?](http://stackoverflow.com/questions/7335920/what-specifically-are-wall-clock-time-user-cpu-time-and-system-cpu-time-in-uni) – Lie Ryan Dec 17 '12 at 13:17
-
1Possible duplicate of [What specifically are wall-clock-time, user-cpu-time, and system-cpu-time in UNIX?](https://stackoverflow.com/questions/7335920/what-specifically-are-wall-clock-time-user-cpu-time-and-system-cpu-time-in-uni) – Farsan Rashid Sep 13 '18 at 07:31
4 Answers
The difference is whether the time is spent in user space or kernel space. User CPU time is time spent on the processor running your program's code (or code in libraries); system CPU time is the time spent running code in the operating system kernel on behalf of your program.

- 28,379
- 9
- 61
- 93
-
1
-
4@user472221 dll is a Win concept. Your question is not OS bounded – Dr. belisarius Nov 30 '10 at 03:48
-
1@user472221 My answer is based on UNIX/Linux; the same concept should apply on Windows. I would guess that most DLLs are user-space, although I am not sure where Windows draws the line. If you really want to find out where your program is using CPU time, use a profiler. – Michael Ekstrand Nov 30 '10 at 13:57
-
1Is "user space" and "kernel space" the same as "user/kernel mode"? If the kernel is running, but in user mode, does this account as user time or system time? Or is this of practical difference only when on a microkernel? – Antonis Christofides May 04 '17 at 16:48
-
1Why make the distinction of user or kernel? For example, is the kernel single threaded so if my process is tying up the kernel with a system call then others have to wait? – JohnMudd Aug 13 '20 at 16:17
-
2@JohnMudd: the programmer may have some intuition about where they expect time to be spent, and if that isn't what's really happening, may want to change their code accordingly. For example, if the program is expected to be waiting in a call to epoll() for I/O to react to, only doing very transient bursts of processing, but it's unexpectedly spending a significant percentage of its time in user mode, then the programmer may want to investigate where and why. For example, if a web server was doing that, it may be someone's managed to get a javascript coin miner to run. – Tony Delroy May 10 '21 at 17:31
User CPU Time: Amount of time the processor worked on the specific program.
System CPU Time: Amount of time the processor worked on operating system's functions connected to that specific program.

- 3,617
- 1
- 24
- 37

- 8,773
- 3
- 43
- 47
-
7
-
13Computer Organization and Design: The Hardware/Software Interface - By David A. Patterson, John L. Hennessy -- Page 30 – N Randhawa Jan 16 '17 at 22:20
-
2So it is possible to have 0 system time for some process if the kernel is free of any execution on the specific thread if I understand well – HoCo_ Jul 23 '19 at 07:06
The term ‘user CPU time’ can be a bit misleading at first. To be clear, the total time (real CPU time) is the combination of the amount of time the CPU spends performing some action for a program and the amount of time the CPU spends performing system calls for the kernel on the program’s behalf. When a program loops through an array, it is accumulating user CPU time. Conversely, when a program executes a system call such as exec or fork, it is accumulating system CPU time.

- 281
- 3
- 2
Based on wikipedia:
- User time is the amount of time the CPU was busy executing code in user space.
- System time is the amount of time the CPU was busy executing code in kernel space. If this value is reported for a thread or process, then it represents the amount of time the kernel was doing work on behalf of the executing context, for example, after a thread issued a system call.

- 759
- 9
- 12