sickfaichezi wrote:
> Can someone tell me whats wrong with this?
>
> This function took 2 minutes to run, but the profiling only reports
> that .3 seconds were used in running the function.
>
> CL-USER> (time (send-mails))
> ; Compiling LAMBDA NIL:
> ; Compiling Top-Level Form:
>
> ; Evaluation took:
> ; 125.44 seconds of real time
> ; 0.31 seconds of user run time
> ; 0.02 seconds of system run time
> ; 41,536,836,807 CPU cycles
> ; 0 page faults and
> ; 931,792 bytes consed.
Does send-mails do all its work in Lisp, or does it spawn other
processes? You're probably getting the total user and system time for
the *Lisp* end of the code.
-- MJF
sickfaichezi wrote:
> Can someone tell me whats wrong with this?
>
> This function took 2 minutes to run, but the profiling only reports
> that .3 seconds were used in running the function.
Two minutes is the real elapsed time. The other measurements are CPU
time, broken into system and user. CPU time stops when your process or
thread is suspended, wheras real time continues to elapse. Your process
is suspended when it waits for another process to do something, when it
waits for an I/O request to complete, or when it has requested an
explicit scheduling delay (sleep).
User time means time spent executing code on behalf of your thread, but
outside of the operating system kernel. System time is the time spent
executing code in the kernel.
If you're interested in knowing more, check out some textbook book on
computer architectures and the design of operating sytsems.
> CL-USER> (time (send-mails))
Sending e-mail requires I/O. No surprises here!
(There are circumstances in which network communication code can keep
the CPU busy, namely when you are transmitting bulk data over a network
which can take it as fast as your computer can shove it into the
network adapter. The actual packet construction, management of the
protocol state, and the up/down calls through the protocol stack and
the application can take long enough that each time the transmit
routine in the driver is visited, it has finished sending).
> What happened to the rest?
The computer gave the rest of the time to other processes while yours
was suspended. If there were no other processes to run, it dispatched
the idle process: a dummy task built into the operating system to
handle the case when there are no processes to run. The idle process
executes a loop. If the hardware provides it, that loop contains a
special machine language instruction which actually halts the CPU
itself until a hardware interrupt takes place. This state causes the
CPU to drain much less current than if it were to keep spinning in the
loop, and that in turn keeps it cooler. The temperature only rises when
intense computation is performed.
"sickfaichezi" <············@gmail.com> writes:
>
> Can someone tell me whats wrong with this?
>
> This function took 2 minutes to run, but the profiling only reports
> that .3 seconds were used in running the function.
>
> CL-USER> (time (send-mails))
> ; Compiling LAMBDA NIL:
> ; Compiling Top-Level Form:
>
> ; Evaluation took:
> ; 125.44 seconds of real time
> ; 0.31 seconds of user run time
> ; 0.02 seconds of system run time
> ; 41,536,836,807 CPU cycles
> ; 0 page faults and
> ; 931,792 bytes consed.
> ;
My first guess for the missing time is some sort of I/O wait.
--
Thomas A. Russ, USC/Information Sciences Institute