[solved] Measuring how much time a bash function takes to run?

Hi there,
a (hopefully) simple question for the bash gods out there :)
Lets say i have a script looking like this:
#!/bin/bash
some_function() {
doing something
some_function
How can i measure the time (preferably in human-readable form: minutes or even hours) the bash function takes for a run?
I know about "time", but i want to do it directly inside the script...
Google tells me nothing, apart from one site where i have to pay for a solution :/
Thanks for any suggestions
Jan
Last edited by funkyou (2008-09-01 13:21:04)

iphitus@laptop:~$ sh test.sh
Hi
Bye
real 0m10.002s
user 0m0.000s
sys 0m0.003s
iphitus@laptop:~$ cat test.sh
somefunc(){
echo "Hi"
sleep 10
echo "Bye"
time somefunc
Time appears to work within bash scripts too

Similar Messages

  • How much time does an AP take to failover to secondary controller

    hi All,
    My query is to understand how much time will an AP take to failover to its secondary WLC(Backup) incase primary goes offline.
    Whats the heartbeat time for each AP to verify reachability to WLC.
    also what is the purpose of AP Fail over priority under each AP. i want to ensure AP's fall back to primary WLC once its back online.(Preemption)

    Hi Matehw,
    My query is to understand how much time will an AP take to failover to its secondary WLC(Backup) incase primary goes offline.
    We can not tell exact time but normally It takes 1-3 minutes.
    Whats the heartbeat time for each AP to verify reachability to WLC.
    AP Heartbeat Timeout - AP sends heartbeat to WLC (By default its 30s). Once the primary WLC(or where AP is connected to)goes down, With heartbeats, the AP realizes sooner that the controller has become unreachable.
    also what is the purpose of AP Fail over priority under each AP.
    First of all there are three types: it goes like this Cirtical...high...medium..low.
    ***To configure AP failover priority, we must enable AP Fallback feature globally and then individual APs with a suitable priority level. 
    *** When using both the local  and global backup configurations, the locally configured settings take precedence in the event of a controller failure. If an AP is not able to join any of the locally configured controllers, it then tries to join the global backup controllers.
    More info:
    http://rscciew.wordpress.com/2014/01/22/ap-failover/
    Regards
    Dont forget to rate helpful posts

  • How much time does it usually takes for moderator approval for a post

    How much time does it usually takes for moderator approval for a post?
    I have a post posted on Mar 9 and it is still pending for moderator approval.

    It's impossible for anyone here to say. It could be very quick, or a given book may never appear. As RG said, it's completely up to the publisher in the applicable country.
    Regards.

  • How much time does ipad 4 take to fully charge???

    how much time does ipad 4 take to fully charge???

    It will obviously vary depending on how drained the battery is, but figure on 3-4 hours for a full charge.

  • How much time does CATPATCH.sql take

    Hi,
    Iam upgrading my db from 9.2.0.1 to 9.2.0.4 . Its been 2 hrs since the catpatch.sql script is runnig. When i queried dba_registry it is showing status as loading for packege & body.
    Can any tell me how much does this script takes.
    Thanks in advance.
    Bhavesh

    The speed of execution is very dependent on the memory and CPU of the machine in which the patch is being applied. I have seen times ranging from 30 minutes to 4 hours. The four hours was experienced with a database in a virtual machine with 512MB of RAM.

  • Estimating how much time a sql will take

    Is there a way to estimate how long a sql will take. Is there a command in sql to estimate the time?
    Is there a direct correction when looking at the COST in the explain plan to the amount of time a sql will take? Thank you in advance.

    No. You might as well ignore the cost number. Anything to do with the cost-based optimizer, Jonathan Lewis is your man. His interpretation of cost is "the time to completion of a query, but expressed in units of single block reads rather than in proper time units".
    Of course, as Tom Kyte points out, the Explain Plan is only a mathematical model predicting the query's performance. Cost is an estimate not a guarantee.
    Cheers, APC

  • How much time does a query take from start to end?

    How can i query the time a SQL command takes from start to end (it was a big query and started yesterday evening when we started work today it was ended)?
    i selected some values of v$sqlarea but i could not understand the result absolutely. is there a more practical way of getting this information?

    select sql_text, cpu_time/100000, elapsed_time/100000 from v$sql where sql_text like '
    If the SQL is still in memory, not 100% reliable and there is a Bug 2101311 V$SQL.CPU_TIME / ELAPSED_TIME wrong for DML statements

  • Approx how much time should JDBC adapter take to insert 1.5 million record?

    Hi All,
              What is the optimum time for inserting 1.5 million records to Oracle Staging Table? My scenario ECC to Oracle is taking 3 hours.
    With your previous experience, what do you think about this. Is there a scope of improvement?
    We have a simple insert through JDBC datatype. i.e Action = INSERT.
    Kindly Advice.
    Regards,
    XIer
    Edited by: XIer on Mar 27, 2008 9:20 AM
    Edited by: XIer on Mar 27, 2008 10:02 AM

    Hi,
    >What do you think is the optimum time with your experience...
    We had Similar Situation  after adding Application Server  the time was reduced to 1 hour.  Now  how many App server are available in your XI system ?
    Regards
    Sangeetha

  • How much time should the installation take?

    It has been an hour and its still 50%.

    It is totally network dependant. Try to turn off security can speed up the process. Also, Try using a wired connection.

  • How much time is on that Playlist-Burning CD

    Is there a better, even slightly more sophisticated way of determining just how much time is on a playlist? For burning to a CD?
    I'm trying to burn a CD that holds 80 minutes, or 700 MB. I know that what that really means is that the CD can accommodate about 74 minutes of recorded time.
    In iTunes, the particular playlist says I've used about 1.3 hours.
    What does that mean?
    How does iTunes calculate the "." something? Does the .1, .2, .3, .4, etc. translate into a defined amount of minutes?
    Does the memory, or size of the particular tune factor in? I didn't think so. I've just been looking at "time." (By the way, all of the tunes on this playlist are AIFF. Didn't bother to convert them to MP3 or AAC.) But I would if I had to. (Just a lot more time and work.)
    There must be a better way of measuring just how much time one has included in a Playlist for burning.
    Any thoughts, advice, suggestions would be very much appreciated.
    P.S. As always, iTunes "Help" has been of no help. Unless they're keeping it a secret somewhere.

    HangTime,
    You're here in iTunes too? You're everywhere. What the heck would I do without you?
    As always, you are right. Problem solved.
    But one more thing, when I went to print out the song list for the CD, the order was all changed. In an order I don't comprehend. How do I get it to print out the songs in the order I have them on my playlist? I need that, to put into the CD sleeve. Have no idea why it came out all jumbled up. Totally, random. Tried to show lists according to Artist, Album, Song, etc. to no avail.

  • Is there a plug-in that tracks how much time you've spent in specific files?

    I want an easy way to track how much time I've spent on certain projects. I really just need a plug-in that tracks how long files have been open. I'm having trouble searching for one like that; does anyone know if this exists as a plug-in or even as a function of Photoshop (or Illustrator)? This would be very helpful for freelancers. Thanks.

    Found this link via Google. I have CS6 and it looks like this, don't know about CC.
    How to Keep a Log of Your Work in Photoshop - Digital Photography School

  • How much times a word appears in a string?

    There is any function to find out how much times a word
    appears in a string?
    For example:
    mystring = "Mytext... text... contentext";
    There is any function to tell me that "text" appears 3 times
    in that string?
    I searched for function like that, but didn't found
    one.

    here's a method that seem fairly consistent using the
    string.split() method - the returned array will always have one
    more index than the places in which the string was split.

  • Determining how much time is left for HttpSession expiration

    Hi,
    Is there any way to determine how much time is left for my session to expire ? What i want to do is, if there is no activity on some page for a long time, then according to the remaining session expiration time, i want to popup a message to the user that 'so much' time is left for his session to expire. If the user wish we can reset the session expired time to its initial value and the session continues.

    Well, see, how are you going to do this even if there was a method (which there is sorta... you need to use getMaxInactiveInterval() and getLastAccessedTime() from session to figure it out yourself). What I mean is, how are you going to tell the user. The JSP can't call the browser to tell it anything, and when the user goes to another page, the timer is reset, so it'll never be below that limit after that request.
    Actually, I can think of only one way, and that is to have a JavaScript code on the page and use setTimeout function to show an alert after the needed time expires.

  • How much time take this applikation?

    Hello,
    I want to measurement the time, that a part of my applikation take.
    E.G.:
    int i = 3+4;
    I want to see how much time this part of code take.
    And then I want to print somethink like that:
    The applikation take 0.02 Milliseconds to summate 3 and 4.
    Thank and Sorry for my terrible English :-)
    Josef L�th

    Theorethically:long time = System.currentTimeMillis();
    int i = 3+4;
    time = System.currentTimeMillis() - time;However, consider that these operations have a precision dependent on the OS you're running them on, and that Java itself is not good at real timing operations. I suppose "time" will always be 0, since that sum operation will take just nanoseconds or less on every kind of modern CPU.

  • How to how much time exp expend

    Dear all,
    I want to exp a big table and want to know how much time it expend? what can i do?
    os:windows

    user7244870 wrote:
    Dear all,
    I want to exp a big table and want to know how much time it expend? what can i do?
    os:windowsYou can try measuring a smaller table, but like Ed said, it may not reflect the larger table. However, depending on things like whether you are using large or special objects, what version you are on, your hardware characteristics, what else is going on on the system, whether you are exporting over a network and some other stuff I can't think of, you may be able to minimize by doing something like:
    exp direct=Y tables=(yourtablename) recordlength=65535 file=yourfile log=yourlog

Maybe you are looking for

  • Trying to increase the sound of recorded screen captures

    Hi. I'm making screen capture movies with Snapz PRo 2 and they are being saved as QT movies on my desktop. When I open them in QT and try to increase the sound volume, the setting don't stick if I try to raise the volume over 0db. I read somewhere th

  • System Settings Add-On Installer on KDE4.9 [Solved/Disregard]

    Hey everyone! I've been having this problem for days now and I can't figure out what to do. So, here's the problem, I have a working internet connection and everything, however, if I want to go and get a new window decoration the Add-On Installer nev

  • Discount Condition in Service Entry Sheet

    Dear All I made a service PO of amount 500 INR and entered discount condition RA01@5%, so net price comes to 475 INR.In PO taxes are getting calculated on 475 INR. Now when I make a Service Entry sheet (SES) of amount 100 INR then in header condition

  • New update affects bluetooth features for audio in car

    Since updating my iphone to the latest version my audio system in my car no longer automatically recognises my phone and recommences playing audio where left off. I have a Mazda CX9. I have contacted Mazda tech and they have informed me that this is

  • Query based on Multiprovider as Datasource

    Hii, I am trying to use query , based on MultiProvider(1cube,2DSO) , as datasource. I want to save the query output in a target . But in the DTP only data from one of these infoprovider is fetched to the target.Where as the query output shows data fr