LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-24-2012, 03:35 PM   #16
antegallya
Member
 
Registered: Jun 2008
Location: Belgium
Distribution: Debian
Posts: 109

Rep: Reputation: 42

Quote:
Thanks. I'm getting "Generations are not sequential !"
That's because you have generations taking place simultaneously. The problem there is to define what to do in that case
If you in your logs something like
Code:
1 generating
4 generating
8 completed
10 completed
Does it means there was a generation that took 4ms and the other took 9. Or the first one took 7ms and the second one took 6ms ?

The code you modified takes the first solution. But I don't find it the most correct as it will most likely give you generation times really far from reality if there's a lot of nesting. I personnaly prefer the second interpretation. For that one, here is another code :
Code:
#!/usr/bin/awk -f
BEGIN {
	idxb = 0;
	idxe = 0;
}

/- generating VirtualCard/ {
	jobs[idxe++] = $1;
}

/Completed generating VirtualCard/ {
	print "Generated a VirtualCard in", ($1 - jobs[idxb++]) / 1000, "s";
}
It doesn't check for an invalid log file anymore. I will give an incorrect generation time if the log starts with "Completed".
I've also modified it to display seconds instead of milliseconds -- it's as simple as dividing the answer by 1000...

Concerning the calling of the script, you can avoid using that loop (which seems somewhat wrong, why do you append the content of the logs to generation.log ?) :
Code:
cat logFile.*.log | ./script.sh > generation.log
Regards,
Antegallya
 
Old 07-24-2012, 06:03 PM   #17
blsimpson
LQ Newbie
 
Registered: Jun 2012
Posts: 15

Original Poster
Rep: Reputation: Disabled
Awesome. That takes care of everything.

The reason I am writing to another log file, is I need to take the times, and plot them in a graph to watch the time increase.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to fetch entries in a log file for a particular period of time ? rhadmn Linux - Enterprise 3 03-19-2012 05:43 AM
Checking Log Entries for Specific Time Duration devUnix Programming 2 02-02-2012 04:49 PM
Need help to have a rsync script log output to a file with time stamp Thaidog Programming 5 11-15-2011 05:37 PM
a command or way to log time of iptables LOG entries? dividingbyzero Linux - Security 3 06-06-2008 01:23 AM
script to find out time taken to transfer a file aeby Linux - Networking 1 05-09-2007 05:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration