Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 06-25-2004, 06:10 AM   #1 (permalink)
astromonkey
Registered User
 
Join Date: Jun 2004
Posts: 3
astromonkey is on a distinguished road
estimating processing time

I'm trying to estimate the processing time of a set of functions written in C. Are there any hints out there for counting flops?

Thanks,
astromonkey
astromonkey is offline   Reply With Quote
Old 06-25-2004, 07:57 AM   #2 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
How accurate do you want it to be?

You can have my code. It is up to 10 micro-seconds accurate, meant to replace the standard profiling utilites usually found on IDE's.

Made for win32 systems, but not all too hard to port.

I can do better, up to about 100 cpu instructions. But you have to give me a reason to invest time. I'm busy and moving away from C++ and assembly.
__________________
Valmont is offline   Reply With Quote
Old 06-25-2004, 08:03 AM   #3 (permalink)
astromonkey
Registered User
 
Join Date: Jun 2004
Posts: 3
astromonkey is on a distinguished road
Valmont,

That's the real question isn't it!

I am currently counting it by hand by adding up all of the *,/,++,--,+,-,cos,sin,sqrt operations. It doesn't count any time required to step into and out of functions and it's quite tedious. I have a fairly safe margin of error in terms of a processing budget so a relatively accurate guess is all that is needed.


Thanks,
astromonkey
astromonkey is offline   Reply With Quote
Old 06-25-2004, 08:06 AM   #4 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
Oopsy, I forgot to send the code. It contains a sample as well. Have fun with it.
*edit*
Erratic behaviour by site.

http://home.tiscali.nl/~valmont/cpp/...s/profiler.zip
__________________
Valmont is offline   Reply With Quote
Old 06-25-2004, 08:10 AM   #5 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
Quote:
Valmont,

That's the real question isn't it!
Yes, that's the question indeed. If you are interested in testing then make a plan. You'll notice you will find the answers, instead of bouncing the question back.

__________________
Valmont is offline   Reply With Quote
Old 06-25-2004, 09:08 AM   #6 (permalink)
astromonkey
Registered User
 
Join Date: Jun 2004
Posts: 3
astromonkey is on a distinguished road
Thank you for your quick responses.
astromonkey is offline   Reply With Quote
Old 06-25-2004, 09:17 AM   #7 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
Uhm. I suddenly realize my code might be a tad too much. I didn't know where you stood from reading the first post.
Start with this:
Code:
#include <iostream>
#include <ctime>
using namespace std;

int main(int argc, char* argv[])
{
	clock_t start, end;
	long double duration;
	start=clock();
	//TODO: code to test here.
	end=clock();
	duration=(long double)(end-start)/CLOCKS_PER_SEC;
	cout<<"Elapsed time: "<<duration<<endl;

	return 0;	
}
__________________
Valmont is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
EMERGENCY: Dynamic form processing DavH27 PHP 8 10-27-2004 07:52 PM
network time synchronisation in java bossebo Java 1 06-21-2004 05:17 PM
Adjusting date() function for time zones Epsilon PHP 1 02-27-2004 02:55 AM
Assign value to a variable depending on time AOD PHP 10 02-12-2003 03:06 PM


All times are GMT -8. The time now is 11:38 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting