Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


CPU Speed tester (written in c++) + binary

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
educofu
Expert Cheater
Reputation: 3

Joined: 21 Aug 2009
Posts: 171
Location: Brazil,MG,OP

PostPosted: Tue Nov 30, 2010 11:37 am    Post subject: CPU Speed tester (written in c++) + binary Reply with quote

i wrote this just for fun.
Code:

#include <iostream>
#include <time.h>
using namespace std;

int action;
int b;
int a=0;

int main ()
{
    cout << "This will test your CPU current speed (in 10 seconds)\n";
    while(clock ()<=10000)
    {
         if (a=clock())b++;
         a=clock();
         }
    b/=100000;
    cout << "\nYour CPU scored " << b << " Points.";
    b*=4.3;
    cout << "\nYour CPU speed is equivalent to " << b << "Mhz.";
    cin >> action;
    exit(0);
}


i got 1206 (5186Mhz) points with a Pentium Dual-Core E5400(2.7GHz x2) and 463 (1991Mhz) Points with a Semprom 2800 (2.0GHz)

binary: http://ifile.it/b8nm67t

post here yours scores and sugestions!

_________________
"I finally started thinking outside of the box, only to find myself in a larger box."


Last edited by educofu on Tue Nov 30, 2010 4:15 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
92Garfield
I'm a spammer
Reputation: 57

Joined: 20 Dec 2007
Posts: 5871
Location: Banana Republic Germany

PostPosted: Tue Nov 30, 2010 11:50 am    Post subject: Reply with quote

Only uses 1 core.

AMD 64 x2 6000+

780 and 3353 Mhz

Also, what is clock()?

_________________
Back to top
View user's profile Send private message
Jorg hi
I post too much
Reputation: 7

Joined: 24 Dec 2007
Posts: 2276
Location: Minnesota

PostPosted: Tue Nov 30, 2010 2:40 pm    Post subject: Reply with quote

I think clock() returns the total clock ticks elapsed since the program was launched. But what Garfield said that it only checks 1 core. And its doesn't do anything with pipelines, and its limited to the compilation of the code. But it still is decent.

My score was 883 Points/3796Mhz.

_________________
CEF will always stay alive.
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Nov 30, 2010 2:48 pm    Post subject: Reply with quote

this is not a very accurate representation of speed, nor a very good test since the number of times it loops (doing almost nothing) is so low
Back to top
View user's profile Send private message
educofu
Expert Cheater
Reputation: 3

Joined: 21 Aug 2009
Posts: 171
Location: Brazil,MG,OP

PostPosted: Tue Nov 30, 2010 3:33 pm    Post subject: Reply with quote

slovach wrote:
this is not a very accurate representation of speed, nor a very good test since the number of times it loops (doing almost nothing) is so low


actually i think this program is a decent test. it works like this:

start counting in ms
get the value of current time in ms
sum how many times the time is the same.

thats in 10 seconds, or 10000 ms, wich allows a good precision of results.

but what i think is that the equivalent speed in MHz shoudnt be always considered, since the constant im using (4.3) may vary according the CPU cache, ram, etc...

also just tested on a Celeron 2.53Ghz + 512 ram and got a result of 366 points and 1573 Mhz

_________________
"I finally started thinking outside of the box, only to find myself in a larger box."
Back to top
View user's profile Send private message MSN Messenger
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25287
Location: The netherlands

PostPosted: Tue Nov 30, 2010 5:08 pm    Post subject: Reply with quote

tip: make it spawn several threads (based on the total number of logical cpu's) and do the calculation in there

then count it all up for a total (spawn all threads at the same time, each thread runs infinitely , wait 10 seconds and then suspend all threads and count how many iterations each thread has done)


also, add some memory access stuff:
add "volatile" before a variable declaration to make sure it's not being optimized into a single register

or if you intend on having register only calculations leave it like this

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Wed Dec 01, 2010 3:25 am    Post subject: Reply with quote

Code:
#include <iostream>
#include <ctime>

int main(int argc, char *argv[])
{
   std::cout << "Clock() is already returning: " << std::endl;
   std::cout << clock() << std::endl;

   int a = 0;
   int b;

   std::cout << "b is just some random value, might not be 0: " << b << ". The compiler warns about it and 2010 CRT won't even run the app if b isn't initialized" << std::endl;

   while(clock() <= 10000) {
      if(a = clock()) {
         std::cout << "This block is executed always" << std::endl;
         b++;
      }
      a = clock();
   }

   std::cout << "What do I do with this a: " << a << std::endl;

   return 0;
}
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Wed Dec 01, 2010 9:52 am    Post subject: Reply with quote

you do know about context switching right ?
Back to top
View user's profile Send private message
educofu
Expert Cheater
Reputation: 3

Joined: 21 Aug 2009
Posts: 171
Location: Brazil,MG,OP

PostPosted: Fri Dec 03, 2010 12:54 pm    Post subject: Reply with quote

just tested on a Celerom M 900 MHz 1 gb and got 311 points (1,33 GHz), This shows i cant consider the equivalent speed.
_________________
"I finally started thinking outside of the box, only to find myself in a larger box."
Back to top
View user's profile Send private message MSN Messenger
Bamases
Newbie cheater
Reputation: -1

Joined: 20 Jun 2009
Posts: 18

PostPosted: Mon Dec 06, 2010 12:14 pm    Post subject: Reply with quote

469 points fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites