Need to check timing statistics



  • 1. What does this do?
    Hi any pointers on what is happening here? awk '(\$2 == \"T\") || (\$2 == \"B\") { sym = \$3; sub(/^_*/, \"\", sym); print sym}' > <temp_file> Executing this is giving the following error: awk: cmd. line:1: (\$2 == \"T\") || (\$2 == \"B\") { sym = \$3; sub(/^_*/, \"\", sym); print sym} awk: cmd. line:1: ^ backslash not last character on line Regards --Hb
  • 2. Creating patch files...
    I think it might be better if I just show this question as an example. I want to "patch" the following target file from within PHP on a LINUX box using a BASH script: ... [BEGIN somesection] ... [END somesection] ... [BEGIN someothersection] ... [END someothersection] ... The line numbers for each section of the file are unknown. My program has many blocks of text that each need to be inserted into specific sections (overwriting any existing content). Each section has a unique name. I can provide the exact text of the BEGIN and END lines of the sections (the syntax is simple and uniform including case and whitespace). I would like to be able to call something like PATCH to do the work for me so that I'm not reinventing the wheel here. I know PATCH can except a number of input formats but as far as I can tell all of them require exact line numbers. Is there a format that can insert patches based on REGEXP matches or something? If not I guess I can GREP for the line numbers then generate a Unified patch on the fly but that is not really as elegant so any help would be great! Maybe there is something obvious that I've never heard of and I'm just barking up the wrong tree here. It just seems like such a common operation. Thanks guys, Robert
  • 3. sed question re deleting path from string
    How can I add backslashes to a string using sed? I want to replace all forward slashes / with a backslssh and a forward slash \/ so /export/home/john becomes \/export\/home/\/john
  • 4. empty options using getopts
    Is there a way to test if an option hasn't been set (using getopts)? Right now I set a flag when an option is set, then test the flag to figure out if the option was set. It's ugly. There's got to be a better way, n'est pas? Cheers, Martin default_foo="bar" while getopts "a:" OPTION ; do case "$OPTION" in a) foo="$OPTARG" a_set=1 ;; esac done if [[ -z $a_set ]] ; then foo=$default_foo a_msg="info: setting foo to $foo" fi

Need to check timing statistics

Postby pankaj_wolfhunter » Thu, 30 Mar 2006 14:31:57 GMT

                I want to run a command and after its execution needs
to know its timing statistics like elapsed time etc.

Can anyone help me on this?


Re: Need to check timing statistics

Postby matt_left_coast » Thu, 30 Mar 2006 14:37:39 GMT

The command you want is `time`


Re: Need to check timing statistics

Postby pankaj_wolfhunter » Thu, 30 Mar 2006 14:41:11 GMT

thanks for the reply matt.
I looked into it. Can you tell me how to implement it properly and what
are the statistics that actually it gives?

Re: Need to check timing statistics

Postby matt_left_coast » Thu, 30 Mar 2006 14:43:28 GMT

In a console window run the command 

man time

That should give you an idea how to run it. 


Re: Need to check timing statistics

Postby Chris F.A. Johnson » Thu, 30 Mar 2006 14:54:41 GMT

   That will depend on whether you use a shell's built-in command or
   an external utility.

   At a shell prompt, type "type time" (without the quotation marks).
   If it tells you that it is a shell keyword or builtin, use "help
   time" or "time --help", depending on which shell you use. If it is
   an external command, such as /usr/bin/time, type "man time".

   Chris F.A. Johnson, author   |    < http://www.**--****.com/ >
   Shell Scripting Recipes:     |  My code in this post, if any,
   A Problem-Solution Approach  |          is released under the
   2005, Apress                 |     GNU General Public Licence

Re: Need to check timing statistics

Postby pankaj_wolfhunter » Thu, 30 Mar 2006 15:02:16 GMT

thanks matt. I got what i wanted. thanks again

Re: Need to check timing statistics

Postby anju » Fri, 31 Mar 2006 00:54:37 GMT


 I implemented the same.

But, I used the external /usr/bin/time for this to find the elapsed
time manually. (GNU time utility is not available on my machine and i
shouldn't use too) (time -d option is not available on machines time

I execute the above said two commands and I didn't get any thing from
the below output's.

# time --help
ksh: --help:  not found.

real    0m0.06s
user    0m0.00s
sys     0m0.00s

# help time

If available, you can refer to the Base Document Library
for general assistance.

Some basic Commands are:

    man -k keyword      - lists commands relevant to a keyword
    man command         - prints out the manual pages for a command
    cat                 - concatenates files (and just prints them out)
    vi                  - text editor
    ls                  - lists contents of directory
    mail                - sends and receives mail
    passwd              - changes login password
    sccshelp            - views information on the Source Code Control
    smit                - system management interface tool
    tset                - sets terminal modes
    who                 - who is on the system
    write               - writes to another user

To find programs about mail, use the command:           man -k mail
and print out the man command documentation via:        man mail
You can log out of the system by typing:                exit

How can utilise the shell's built-in command  to get the start time,
end time and elapsed time?


Re: Need to check timing statistics

Postby Bill Marcum » Fri, 31 Mar 2006 02:58:57 GMT

On 29 Mar 2006 07:54:37 -0800, anju 

date; time yourcommand; date

Be not anxious about what you have, but about what you are.
		-- Pope St. Gregory I

Re: Need to check timing statistics

Postby bonomi » Sun, 02 Apr 2006 22:46:01 GMT

In article < XXXX@XXXXX.COM >,

*SIGH*   =reading= counts.   the prior note (that you _didn't_ quote any of)
said to try 'man time'.  *not* 'help time'.

Just like the 2nd 'hint' in the "basic commands" description that you did

Repeating: 'reading counts'.   Even on AIX.

Similar Threads:

1.gprof needs static link to check time?

2.Timmytroll needs to find a hobby (was: Roy needs to learn time management)

Tim Smith wrote:

> RoyRoyRoyRoyRoyRoyRoyRoyRoyRoyRoyRoyRoyRoyRoy
> RoyRoyRoyRoyRoyRoyRoyRoyRoyRoyRoyRoyRoyRoyRoy
> RoyRoyRoyRoyRoyRoyRoyRoyRoyRoyRoyRoyRoyRoyRoy
> RoyRoyRoyRoyRoyRoyRoyRoyRoyRoyRoyRoyRoyRoyRoy

Owner/proprietor, Trollus Amongus, LLC

...Golden Rule: He who has the gold makes the rules.

3.Real time cpu statistics?

I tried to find a way to get real time cpu usage (not only per process
but also per thread). top and ps are not able to show this
kernel 2.6, nptl. Is there other method or do I need to grep through
and parse it?

Thanks in advance for any ideas.

4.NTP Jitter Statistics - time goes backwards?

 XXXX@XXXXX.COM  (Roy) writes:

> I understand the output of the NTP jitter program correctly, it looks
> like the time on my system jumps backwards about 0.02 percent of the

Known problem.  Unknown reason (or it would have been fixed already).
In /sys/kern/kern_synch.c you'll find:

#if 0
                printf("time is not monotonic! "
                    "tv=%ld.%06ld, runtime=%ld.%06ld\n",
                    tv.tv_sec, tv.tv_usec, runtime.tv_sec, runtime.tv_usec);

Enable the printf you'll find the message in your logs.

// marc

5.[PATCH 5/9] device-mapper disk statistics: timing

6. [RFC] [Patch 3/4] statistics: sets of statistics in single file

7. [RFC] [Patch 1/3] readahead statistics slimmed down, statistics prereq

8. [Patch] statistics: simplify statistics' debugfs read functions

Return to unix


Who is online

Users browsing this forum: No registered users and 8 guest