Email: bknpk@hotmail.com Phone: +972-54-7649119
V

 

ASIC/FPGA Design and Verification Out Source Services

A simple script to measure the time for a job pending in lsf.

  1. This script simply measures the time a job is pending in lsf.

  2. It can be a base for similar scripts, which measure a process duration, or trigger action upon process end detection.

  3. First, statement in the script, a grep command is prepared. Then a while loop starts and continues as long as the grep command returns success status. The script has a 5 second sleep command in the while loop, in order not to load too much the CPU. The script calculates the elapsed time in seconds. Although I could just add 5 to a simple counter, in the script, (because the 5 second sleep command), I decided to use date command, as shown below.

      eval $cmd
      sleep 5
      time_end=`date +%s`
      time_tot=$(($time_end - $time_start))
      echo -ne "${time_tot} seconds\r"

    Note: that
    date +%s
    did not work on SunOS and did work well a linux machine. Instead I use perl to get the time for the bash script:
    time_start= `perl -e '$t=time(); print("$t\n")'`

    A nice display for the total time consumed is also added. The number of seconds is converted to minutes and hours if the value is greater than 60 / 3600 respectively.
    1. div="60"
    2. if [ "${time_tot}" -gt "$div" ] ; then
    3.   time_tot_m=$(($time_tot / $div))
    4.   time_tot=$(($time_tot % $div))
    5.   if [ "${time_tot_m}" -gt "$div" ] ; then
    6.     time_tot_h=$(($time_tot_m / $div))
    7.     time_tot_m=$(($time_tot_m % $div))
    8.   else
    9.     echo "job is not pending any more "${time_start}" "$time_end" "${time_tot_m}" minutes "${time_tot}" seconds"
    10.   fi
    11. else
    12.   echo "job is not pending any more "${time_start}" "$time_end" "${time_tot}" seconds"
    13. fi


  4. The script is available at: pending time measure bash script

  5. Script invocation is as simple as:
    ~/bin/lsf_pend_time_measure.unx 1616161

  6. Where 1616161 is the job number in lsf.

  ...


Home

A simple script to calculate the percent of failing number of tests from the total and rounding up the results


SD slave with Samsung flash k9f1208 (vhdl project).






Search This Site


Feedback This Site




new pages on this site