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