Sponsored Content
Top Forums Shell Programming and Scripting Runtime informations - bash script Post 302364916 by TehOne on Saturday 24th of October 2009 02:55:27 PM
Old 10-24-2009
Question Runtime informations - bash script

Hello,

I'm running a bash script and I'd like to get more accurate a runtime information then now.

So far I've been using this method:

Code:
STARTM=`date -u "+%s"`
.........
*script function....
.........
STOPM=`date -u "+%s"`
RUNTIMEM=`expr $STOPM - $STARTM`
if (($RUNTIMEM>59)); then
TTIMEM=`printf "%dm%ds\n" $((RUNTIMEM/60%60)) $((RUNTIMEM%60))`
else
TTIMEM=`printf "%ds\n" $((RUNTIMEM))`
fi

echo "Executing "script function" took: $TTIMEM"

However the script often runs under one second, so the result is 0s.

I'd like it display a more accurate runtime, best 0.015s or 1.123s and so on...

Last edited by TehOne; 10-24-2009 at 04:09 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to read i-node informations (date of creation)

Hi, I'm looking for a way to get the date of creation for a file. Is it possible ? I know that these informations are in the i-node but I don't know how to access them (if the 'find' command can do it with option -ctime, I have reasons to believe in it). Thanks for helping me ! (1 Reply)
Discussion started by: mullmafr
1 Replies

2. Programming

how to programatically obtain informations about existing NICs on the system

hi, i would like to know how to programatically obtain informations about existing NICs (both configured and non-configured if possible) on *NIX? i need to write simple *NIX C/C++ program that will have these informations. i have tried to search forums (and also google) with no luck. any help... (2 Replies)
Discussion started by: nikoladsp
2 Replies

3. Shell Programming and Scripting

execution time / runtime -- bash script please help!

Hello, I'm running a bash script and I'd like to get more accurate a runtime information then now. So far I've been using this method: STARTM=`date -u "+%s"` ......... *script function.... ......... STOPM=`date -u "+%s"` RUNTIMEM=`expr $STOPM - $STARTM` if (($RUNTIMEM>59)); then... (6 Replies)
Discussion started by: TehOne
6 Replies

4. Shell Programming and Scripting

shell script for finding average runtime of other script

so I've made a shell script that downloads 6 files in succession from a given url, then deletes them. Now I want to time the script, and the average time it uses by running it ~100 times. My problem is tho, how do I store the time it takes for each run through of the script? I know time writes to... (3 Replies)
Discussion started by: navlelo
3 Replies

5. Homework & Coursework Questions

Shell Script average runtime

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Make a bash script that calculates average runtime for the first two scripts you made. The average should be... (17 Replies)
Discussion started by: navlelo
17 Replies

6. Solaris

Command History - size, security and more informations

Hi! I need to know how to increase the size of History, creating greater security in it, and view commands with details such as date and time; Also need to know if they learn to write a 'history' command made ​​via WinSCP; Thank you! ---------- Post updated at 01:36 PM ----------... (4 Replies)
Discussion started by: poyato
4 Replies

7. Shell Programming and Scripting

awk/sed inserting muliple informations in one column

I'm probably sure I need to use either awk or sed judging by research but I'm not sure what exact command I have to do to do following...:wall: So this is my text file CPU 1 2 3 4 5 6 RAM 2 3 4 5 6 7 HAR 3 4 5 6 7 8 -------------- my input: Cur_CPU=10 Cur_RAM=11 Cur_HAR=13 Desired... (5 Replies)
Discussion started by: simonirang
5 Replies

8. Shell Programming and Scripting

Shell script to create runtime variables based on the number of parameters passed in the script

Hi All, I have a script which intends to create as many variables at runtime, as the number of parameters passed to it. The script needs to save these parameter values in the variables created and print them abc.sh ---------- export Numbr_Parms=$# export a=1 while do export... (3 Replies)
Discussion started by: dev.devil.1983
3 Replies

9. UNIX for Beginners Questions & Answers

Bash array variables are changed in loop runtime

I am trying to check whether particular host and port are responding or not. I am using below script to check. but node_port array that i am using in loop is getting replaced with previous iteration value. Script and output is given. Please help me to understanding why node_port values are... (5 Replies)
Discussion started by: tmalik79
5 Replies

10. Shell Programming and Scripting

Bash Scripting: Adding runtime in a progress bar

I have the following code that generates a progress bar and want to add the current execution time after the percentage value. The current execution time is stored in the variable `runtm` I am having a problem on how to add `runtm` in the last `printf` or after it. i=0; j=0 ... (3 Replies)
Discussion started by: kristinu
3 Replies
PCT-SCANNER-SCRIPT(1)					      General Commands Manual					     PCT-SCANNER-SCRIPT(1)

NAME
pct-scanner-script - easy scan and create merged DjVu and PDF documents for archiving SYNOPSIS
pct-scanner-script [--help] DESCRIPTION
pct-scanner-script is a bash script and configuration system to easily scan documents and create a digital archiving. It can create DjVu PDF and JPEG outputs, in merged and individual files. It also has a configuration system where different configurations can be defined, making it easy to switch between configurations. Please use pct-scanner-script --help to find all program options, the complete help, and all examples. Features: - auto archiving in merged and individual DjVu, PDF, and JPEG files - auto and manual resume when scanning somehow fails - cascading configuration system, for easy customizing - easy command-line-style bash program, with useful options - archiving made possible with both adf and flatbed scanners - built for productivity and daily use - uses bash, scanadf and other mainstream processing tools - multilanguage commandline output OPTIONS
-h, --help, -? Show summary of options, help, and examples. DEBUGGING
This program is a helper script to easy scan and automated digital document archiving for normal and adf scanners. You can debug this script by running it as bash -x pct-scanner-script [options]. The script is just a nice wrapper for the scanadf, DjVu and PDF tools. SEE ALSO
scanadf(1), AUTHOR
pct-scanner-script and this manual page are written by: Jelle de Jong <jelledejong@powercraft.nl>. March 31, 2009 PCT-SCANNER-SCRIPT(1)
All times are GMT -4. The time now is 10:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy