I need a simple program which counts the elapsed time starting from a given point. Could you give some suggestions? -- Cristea Bogdan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Friday 06 July 2007 09:55:09 Cristea Bogdan wrote:
I need a simple program which counts the elapsed time starting from a given point. Could you give some suggestions?
for the shell, just use time: time somecommand will gve to you the time (user time and total time, that is total - syscalls) when the program finishes. Something similar, for use in C++ code, look how Measure class is implemented: http://svn.opensuse.org/svn/zypp/trunk/libzypp/zypp/base/Measure.h http://svn.opensuse.org/svn/zypp/trunk/libzypp/zypp/base/Measure.cc You can see the docs in the header file itself. Is that what you are looking for? -- Duncan Mac-Vicar Prett Novell :: SUSE R&D, Maxfeldstr. 5, 90409 Nürnberg GF: Markus Rex, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
In my case, I need to start the counter on the host (PC) and in parallel to launch some process on a target (switch). On 7/6/07, Duncan Mac-Vicar Prett <dmacvicar@suse.de> wrote:
On Friday 06 July 2007 09:55:09 Cristea Bogdan wrote:
I need a simple program which counts the elapsed time starting from a given point. Could you give some suggestions?
for the shell, just use time:
time somecommand
will gve to you the time (user time and total time, that is total - syscalls) when the program finishes.
Something similar, for use in C++ code, look how Measure class is implemented:
http://svn.opensuse.org/svn/zypp/trunk/libzypp/zypp/base/Measure.h http://svn.opensuse.org/svn/zypp/trunk/libzypp/zypp/base/Measure.cc
You can see the docs in the header file itself.
Is that what you are looking for?
-- Duncan Mac-Vicar Prett Novell :: SUSE R&D, Maxfeldstr. 5, 90409 Nürnberg GF: Markus Rex, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-- Cristea Bogdan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Fri, 2007-07-06 at 20:21 +0300, Cristea Bogdan wrote:
In my case, I need to start the counter on the host (PC) and in parallel to launch some process on a target (switch).
time ssh switch some-process perhaps? Cheers, Dave
On 7/6/07, Duncan Mac-Vicar Prett <dmacvicar@suse.de> wrote:
On Friday 06 July 2007 09:55:09 Cristea Bogdan wrote:
I need a simple program which counts the elapsed time starting from a given point. Could you give some suggestions?
for the shell, just use time:
time somecommand
will gve to you the time (user time and total time, that is total - syscalls) when the program finishes.
Something similar, for use in C++ code, look how Measure class is implemented:
http://svn.opensuse.org/svn/zypp/trunk/libzypp/zypp/base/Measure.h http://svn.opensuse.org/svn/zypp/trunk/libzypp/zypp/base/Measure.cc
You can see the docs in the header file itself.
Is that what you are looking for?
-- Duncan Mac-Vicar Prett Novell :: SUSE R&D, Maxfeldstr. 5, 90409 Nürnberg GF: Markus Rex, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-- Cristea Bogdan
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Fri, 2007-07-06 at 10:55 +0300, Cristea Bogdan wrote:
I need a simple program which counts the elapsed time starting from a given point. Could you give some suggestions?
I regularly use C/C++ programs for this. The starting point is #include<sys/resource.h> #include<sys/time.h> and the getrusage functions. If you want more details, email me or the suse-programming-e list. -- JDL -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Fri, 06 Jul 2007, by cristeab@gmail.com:
I need a simple program which counts the elapsed time starting from a given point. Could you give some suggestions?
STARTTIME=$( date +%s ) <do something> ENDTIME=$(date +%s) ELAPSETIME=$((ENDTIME - STARTTIME)) Working out minutes and hours is left as exercise for the reader, as usual. Otherwise Python and Perl have easy to use modules to do these things. Theo -- Theo v. Werkhoven Registered Linux user# 99872 http://counter.li.org ICBM 52 13 26N , 4 29 47E. + ICQ: 277217131 SUSE 10.2 + Jabber: muadib@jabber.xs4all.nl Kernel 2.6.18 + See headers for PGP/GPG info. Claimer: any email I receive will become my property. Disclaimers do not apply. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
This is the approach I have chosen to create a simple bash script which acts as a counter. http://bashscripts.org/viewtopic.php?t=401 On 7/9/07, Theo v. Werkhoven <theo@ferrets4me.xs4all.nl> wrote:
Fri, 06 Jul 2007, by cristeab@gmail.com:
I need a simple program which counts the elapsed time starting from a given point. Could you give some suggestions?
STARTTIME=$( date +%s ) <do something> ENDTIME=$(date +%s)
ELAPSETIME=$((ENDTIME - STARTTIME))
Working out minutes and hours is left as exercise for the reader, as usual.
Otherwise Python and Perl have easy to use modules to do these things.
Theo -- Theo v. Werkhoven Registered Linux user# 99872 http://counter.li.org ICBM 52 13 26N , 4 29 47E. + ICQ: 277217131 SUSE 10.2 + Jabber: muadib@jabber.xs4all.nl Kernel 2.6.18 + See headers for PGP/GPG info. Claimer: any email I receive will become my property. Disclaimers do not apply. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-- Cristea Bogdan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Fri, 06 Jul 2007, by cristeab@gmail.com:
I need a simple program which counts the elapsed time starting from a given point. Could you give some suggestions?
Another way would be to create one file at the start time and another at the end time, then calculate the differences in the creation times, e.g., touch startfile (time marches on) touch finishfile #output files' mod times in seconds since Epoch's begin; pipe to bc echo $(stat -c %Y finishfile)-$(stat -c %Y startfile) | bc #clean up rm startfile finishfile The above could go into a script with prompts or you could play around with glade, a nifty GUI front-end builder. Building GUI front-ends isn't that tough on Tk either. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
ken wrote:
Fri, 06 Jul 2007, by cristeab@gmail.com:
I need a simple program which counts the elapsed time starting from a given point. Could you give some suggestions?
Another way would be to create one file at the start time and another at the end time, then calculate the differences in the creation times, e.g.,
touch startfile (time marches on) touch finishfile
#output files' mod times in seconds since Epoch's begin; pipe to bc echo $(stat -c %Y finishfile)-$(stat -c %Y startfile) | bc
#clean up rm startfile finishfile
That's what the damned time command is for, you twit. Compared to using the time command, that's just a f***ing stupid waste of resources, kernal I/O, and it's problematic to boot (if the computer is rebooted during the job, then the start file is left to litter the filesystem. With apologies to South Park: "dubbmb-dumb-dumb-dumb-dummb-dummb-dummb") Just because you "can" do something doesn't mean it's advisable, or even worth considering for more than, oh, 1/10th of a second. Linux is not Windows, so kindly quit offering solutions which are most appropriate for that horrific abortion of an O/S.
The above could go into a script with prompts or you could play around with glade, a nifty GUI front-end builder. Building GUI front-ends isn't that tough on Tk either.
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Aaron Kulkis wrote:
Linux is not Windows, so kindly quit offering solutions which are most appropriate for that horrific abortion of an O/S.
Responses like this make the writer appear to be very young, or very inexperienced with computers, or both. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Jerry Houston wrote:
Aaron Kulkis wrote:
Linux is not Windows, so kindly quit offering solutions which are most appropriate for that horrific abortion of an O/S.
Responses like this make the writer appear to be very young, or very inexperienced with computers, or both.
I've been programming since 1980. I'm more than familiar with more than half a dozen distinct operating sytems (and that's counting ALL of Linux and Unix as ONE O/S). I've written operating systems, including a multi-user, multi-tasking one on a mere 8-bit 6809... And your point is? -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Aaron Kulkis wrote:
Jerry Houston wrote:
Aaron Kulkis wrote:
Linux is not Windows, so kindly quit offering solutions which are most appropriate for that horrific abortion of an O/S.
Responses like this make the writer appear to be very young, or very inexperienced with computers, or both.
I've been programming since 1980.
I'm more than familiar with more than half a dozen distinct operating sytems (and that's counting ALL of Linux and Unix as ONE O/S).
I've written operating systems, including a multi-user, multi-tasking one on a mere 8-bit 6809...
And your point is? I do not know, but my point is that your way of answering discourages
people, does not give an understandable solution to the questioner and makes you look bad. Furthermore you are the very first person that I have just scripted to ignore. Congratulations to myself for being a happy damned twit. Eberhard -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Wednesday 05 September 2007 14:00, Aaron Kulkis wrote:
Jerry Houston wrote:
Aaron Kulkis wrote:
Linux is not Windows, so kindly quit offering solutions which are most appropriate for that horrific abortion of an O/S.
Responses like this make the writer appear to be very young, or very inexperienced with computers, or both.
I've been programming since 1980.
We are supposed to be impressed?
I'm more than familiar with more than half a dozen distinct operating sytems (and that's counting ALL of Linux and Unix as ONE O/S).
Again, we are supposed to be impressed?
I've written operating systems, including a multi-user, multi-tasking one on a mere 8-bit 6809...
Gee,I guess we are supposed to be impressed.
And your point is?
You sound like a jacka$$.. That's the point. Every response you made today was derogatory. Absolutely nothing constructive. Blah., blah, Bitch, bitch, bitch. Don't bother, you made the kill file. -- Powered by SuSE 10.0 Kernel 2.6.13 X86_64 KDE 3.4 Kmail 1.8 3:59pm up 20 days 19:32, 5 users, load average: 2.22, 2.24, 2.36 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Wednesday 05 September 2007 14:00:21 Aaron Kulkis wrote:
Jerry Houston wrote:
Aaron Kulkis wrote:
Linux is not Windows, so kindly quit offering solutions which are most appropriate for that horrific abortion of an O/S.
Responses like this make the writer appear to be very young, or very inexperienced with computers, or both.
I've been programming since 1980.
I'm more than familiar with more than half a dozen distinct operating sytems (and that's counting ALL of Linux and Unix as ONE O/S).
I've written operating systems, including a multi-user, multi-tasking one on a mere 8-bit 6809...
And your point is?
I don't know about his point, but my point is that if the above is really true, you really should spend less time behaving like a sociopathic 8-year old A quick google reveals that you behave like this all over the internet. It really isn't very nice -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Anders Johansson wrote:
On Wednesday 05 September 2007 14:00:21 Aaron Kulkis wrote:
Jerry Houston wrote:
Aaron Kulkis wrote:
Linux is not Windows, so kindly quit offering solutions which are most appropriate for that horrific abortion of an O/S.
Responses like this make the writer appear to be very young, or very inexperienced with computers, or both.
I've been programming since 1980.
I'm more than familiar with more than half a dozen distinct operating sytems (and that's counting ALL of Linux and Unix as ONE O/S).
I've written operating systems, including a multi-user, multi-tasking one on a mere 8-bit 6809...
And your point is?
I don't know about his point, but my point is that if the above is really true, you really should spend less time behaving like a sociopathic 8-year old
A quick google reveals that you behave like this all over the internet. It really isn't very nice
Sometimes *it is better to be quiet and let people* *think* you are an idiot than to open your mouth and prove it, as the old saying goes. I stay quiet a lot :) Cheers Pete -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Aaron Kulkis wrote:
Jerry Houston wrote:
Aaron Kulkis wrote:
Linux is not Windows, so kindly quit offering solutions which are most appropriate for that horrific abortion of an O/S.
Responses like this make the writer appear to be very young, or very inexperienced with computers, or both.
I've been programming since 1980.
I'm more than familiar with more than half a dozen distinct operating sytems (and that's counting ALL of Linux and Unix as ONE O/S).
I've written operating systems, including a multi-user, multi-tasking one on a mere 8-bit 6809...
And your point is?
De Cafe maybe??? -- David C. Rankin, J.D., P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 (936) 715-9333 (936) 715-9339 fax www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Weddnesday, 5. September 2007 12:55 Jerry Houston wrote:
Aaron Kulkis wrote:
Linux is not Windows, so kindly quit offering solutions which are most appropriate for that horrific abortion of an O/S.
Responses like this make the writer appear to be very young, or very inexperienced with computers, or both. Dear youngsters, What do you do ?? Why do you disencourage any writer in this way? He got a question and i think it is always ok to ask any question regarding openSuSE. So my question again: Why?
With regards Rainer Brinkmann germany --
per aspera ad astra <<< -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (14)
-
Aaron Kulkis
-
Anders Johansson
-
Cristea Bogdan
-
Dave Howorth
-
David C. Rankin
-
Duncan Mac-Vicar Prett
-
Eberhard Roloff
-
Jerry Houston
-
John D Lamb
-
ken
-
Mike
-
Pete Connolly
-
Rainer Brinkmann
-
Theo v. Werkhoven