make
/ make all
make clean
run
Default task (io) executed if no args provided.
lab3
lab3 io
lab3 cpu
lab3 cpu-io
A vagrant virtual-box running Ubuntu was used to compile and run the code using a Makefile while remaining on the Windows host machine.
IDE: Intellij Clion 2020.2.4
OS: Windows 10 Ubuntu 18.04
Compiler: g++ clang
Tools: Vagrant 2.2.10 Virtual Box 6.1
A program illustrating the use of signals and interval timers to measure the execution time of a process in terms of Real, Virtual and Profiling time using the corresponding timers, as well as implementing the SIGUSR1
and SIGUSR2
signals.
- A
sigaction
structure is set up with a signal handler to handle signalsSIGUSR1
,SIGUSR2
,SIGALRM
,SIGVTALM
andSIGPROF
. - The timers are then set up with a
itimerval
structure with an expiration time of 5 seconds. - The appropriate task is then started (determined by command-line argument).
- Finally, a signal handler manages the signals generated by the timers using
getitimer
to calculate elapsed real, virtual and profiling times of the process.
Running the different types of tasks should produce different values for each of the timers.
Real time remains the same as this measures wall-clock time. Virtual time indicates only the time used by the process. Profiling time indicates virtual time plus time spend in systems calls for the process.
Thus, CPU-intensive tasks will result in higher virtual time, while I/O-heavy tasks should result in a higher prof time. A combination of both CPU- and I/O-heavy tasks means both virtual and profiling time will be higher.