ASIC/FPGA Design and Verification Out Source Services
A perl script example, that prints the scripts
process ID and measures the time, which
it takes the script to finish its work.
-
This script is just an example, which shows
how to get the process ID (same as in a bash script
$$
example
).
The script also demonstrates how to measure the
time
it takes the script to finish.
-
The simple example is shown below:
#!/bin/perl
$start_t=time();
sleep(8);
system("ps -aefH | grep examp_time_pID");
print("$$\n");
$time_t=time()-$start_t;
print("$time_t\n");
-
The output of the script is listed below:
pini@colinux:~/Home_2/GeneralInfo/youtube$ perl ~/bin/examp_time_pID.pl
pini 4292 3030 0 09:58 pts/0 00:00:00 perl /mnt/Home/pini/bin/examp_time_pID.pl
pini 4293 4292 0 09:58 pts/0 00:00:00 sh -c ps -aefH | grep examp_time_pID
4292
8
|