CPU freq.

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

CPU freq.

#1 Post by beanybabe » Mon Jul 27, 2015 3:25 pm

the original numbers were found to be correct.
ignore this..


It been bugging me that it shows my cpu freq wrong. I did some calculations and think this line in bot.lua needs to be.

bot.GetTimeFrequency = getTimerFrequency().low / 976.56075;
Last edited by beanybabe on Tue Jul 28, 2015 10:46 am, edited 1 time in total.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: CPU freq.

#2 Post by rock5 » Mon Jul 27, 2015 3:45 pm

I don't know why it would bug you but I tested your change and it gives the right frequency for me. I don't know why dividing by 1000 gives the wrong value. I think we need to here from administrator.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: CPU freq.

#3 Post by beanybabe » Mon Jul 27, 2015 4:46 pm

It was off by 900mhz on mine now it is dead on.
Running 2 char with the new number and changes to skills it seems to be working much better. Now need to get it to do a daily without using dailynotes.

I may run a test and figure what that second number needs to be also.

User avatar
Bill D Cat
Posts: 555
Joined: Sat Aug 10, 2013 8:13 pm
Location: Deep in the Heart of Texas

Re: CPU freq.

#4 Post by Bill D Cat » Mon Jul 27, 2015 5:39 pm

I would think the magic number would be 976.5625 which is 1,000,000 / 1024. Of course, there could be other factors involved in this calculation.
Last edited by Bill D Cat on Tue Jul 28, 2015 6:17 am, edited 1 time in total.

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: CPU freq.

#5 Post by beanybabe » Mon Jul 27, 2015 5:52 pm

I just took my cpu freq which I knew and divided it in to getTimerFrequency().low which gave me the 976.56075
So now if you take getTimerFrequency().low / 976.56075 = corrected freq
Get program called speecy http://www.piriform.com/speccy and find out you cpu freq and see it it is right now.

User avatar
Bill D Cat
Posts: 555
Joined: Sat Aug 10, 2013 8:13 pm
Location: Deep in the Heart of Texas

Re: CPU freq.

#6 Post by Bill D Cat » Mon Jul 27, 2015 6:26 pm

Speccy says my CPU frequency is 1900MHz. getTimerFrequency().low returns 1852017. 1852017 / 1900 = 974.7457894736842. Not exactly a perfect number to use for calculating the frequency.

Using my value of 976.5625 in the calculation returns 1896.465408MHz
Using your value of 976.56075 in the calculation returns 1896.4688064721MHz
That's only a difference of 0.0034MHz and certainly not worth worrying about.

Either way, I'm pretty sure the frequency is being rounded up by Speccy, so whatever value makes you happy to see is probably fine.

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: CPU freq.

#7 Post by beanybabe » Mon Jul 27, 2015 7:03 pm

I tried this program CPU-Z http://www.cpuid.com/softwares/cpu-z.html and the numbers were strange. it must be due to they way multiple cores work.
I will try it on some other machines there has to be a way to calculate it.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: CPU freq.

#8 Post by rock5 » Tue Jul 28, 2015 3:46 am

I have Astra32 installed on all my computers to give me hardware info. It says my frequency is 2493.8 MHz.

Code: Select all

Lua> print(getTimerFrequency().low / 976.56075)
2493.7844368617
Lua> print(getTimerFrequency().low / (1000000/1024))
2493.779968
Both are pretty close but obviously 2493.8 is rounded too much to be sure. But seeing as Bill D Cats explanation is logical I'd go with that.

I'm not sure what effect changing it will have on bot performance, if any.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: CPU freq.

#9 Post by beanybabe » Tue Jul 28, 2015 9:30 am

Rock 1566.385435881 is your number print(getTimerFrequency().low/2493.8)=1566.385435881
so you wound need to change to this bot.GetTimeFrequency = getTimerFrequency().low / 1566.385435881;
I have not had a crash yet other than the usual rom crashes with the numbers and changes to skill.xml

I was just wondering if it will help with places that the bot gets stuck or moves back and forth and during lag were it can bump into things. Im unsure how they use the timer but if it is used to time movements it can affect things. my cpu uses many core all seem to be running at a lower freq below 1000 but it adds them together. Depending on how you add them you can end up with different numbers over 700 mhz apart. So i'm at a loss on how to find the right number. I was thinking of just getting a stop watch and running a timer loop in rom and compare it to get a number. For now i'll try that number I posted and see if the strangeness goes away.
Last edited by beanybabe on Tue Jul 28, 2015 10:23 am, edited 1 time in total.

User avatar
Administrator
Site Admin
Posts: 5306
Joined: Sat Jan 05, 2008 4:21 pm

Re: CPU freq.

#10 Post by Administrator » Tue Jul 28, 2015 9:59 am

Frequency is determined here by QueryPerformanceFrequency: https://msdn.microsoft.com/en-us/librar ... 85%29.aspx

The bot does, however, have a fall-back for older versions of MicroMacro that did not support getTimerFrequency():

Code: Select all

	if( getTimerFrequency ) then
		-- Grab the real frequency instead of calculating it, if available
		bot.GetTimeFrequency = getTimerFrequency().low / 1000;
	else
		-- calculate the CPU Frequency / used for manipulation the GetTime() values
		local calc_start = getTime();
		yrest(1000);
		local calc_end = getTime();
		bot.GetTimeFrequency = (calc_end.low - calc_start.low) / 1000;
	end
First make sure that you are executing the section even related to reliably grabbing the frequency from Windows (via getTimerFrequency()). If you are falling back on the calculated method, then you should upgrade MicroMacro.

Finally, frequency is not a measure of speed. It is a measure of the number of oscillations of the quartz crystal that is used to synchronize the operations of the CPU (wow, that was a mouthful) which is a physical constant (and why quartz crystals are used to keep clocks on track). The actual speed of a processor is variable.

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: CPU freq.

#11 Post by beanybabe » Tue Jul 28, 2015 10:25 am

ok the original number is correct. this thread is of no use.. sorry for misunderstanding it.

On my computer the frequency they use it what the ram is running at not the cpu.

User avatar
Ego95
Posts: 564
Joined: Tue Feb 28, 2012 12:38 pm
Contact:

Re: CPU freq.

#12 Post by Ego95 » Wed Jul 29, 2015 9:13 am

Just asking, because this topic has been created now: A few years ago (2-3) I got a CPU frequency of about 2300 too, of course not exactly, but something around that value. Since about a year micromacro shows the exact value of 25000, which is pretty high. Any reason why it says 25k? Seems to me, that its unable to read out the value.

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: CPU freq.

#13 Post by BlubBlab » Wed Jul 29, 2015 12:15 pm

you could go to the function and check why it say so but like Rock5 at some point the bot became an upgrade of the underline function.
Last edited by BlubBlab on Fri Jul 31, 2015 3:39 am, edited 1 time in total.
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: CPU freq.

#14 Post by beanybabe » Wed Jul 29, 2015 12:49 pm

I think the number it is reading may been from the days of single core cpu's I notice that multi-core cpu's are different
if you have what they sell as a 3ghz cpu quad core the real speed is more based on the ram speed than cpu. If your motherboard has 2 4 6 8 ram slots the number of ram and the way its set in Cmos (It may be eeram also) can affect speed
To get cpus to run cool they use multiple cores at slower speeds and jump tasks between them. Also memory is run in interleaved mode if you have it enabled and enough sticks of memory installed. A quad core 3 gh is really 3000/4 or 750 mhz or so but with interleaving it multitasks the ram to get more speed. getting the true speed of a system is tricky.
Energy saver mode will shut down parts of a system to lower heat even as far as turning off cores in the cpu with lowers speed.
Not all cpu are the same also the little letters at the end of a cpu mean it has added or removed features Its good to do a little reading on cpus if you are wanting to save energy or get the most performance.
Motherboards also have a big effect. Some cheat you by using half size data/address buss, less interupts and slower dma (direct memory addess) chips and software network and sound that needs cpu power and really can lag up games. If you ever wonder why some main boards run 300.00 and others 50 this is why.

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: CPU freq.

#15 Post by beanybabe » Wed Jul 29, 2015 1:56 pm

I found this that explains it well and how to work around it. rombot apears to use both of these for its calculations in timer.cpp.

Game Timing and Multicore Processors
https://msdn.microsoft.com/en-us/librar ... s.85).aspx

-- Here is a excerpt of the page --
"With power management technologies becoming more commonplace in today's computers, a commonly-used method to obtain high-resolution CPU timings, the RDTSC instruction, may no longer work as expected. This article suggests a more accurate, reliable solution to obtain high-resolution CPU timings by using the Windows APIs"
The code:

Code: Select all

BOOL WINAPI QueryPerformanceFrequency(
  _Out_ LARGE_INTEGER *lpFrequency
);
OR:

Code: Select all

BOOL WINAPI QueryPerformanceCounter(
  _Out_ LARGE_INTEGER *lpPerformanceCount
);

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: CPU freq.

#16 Post by beanybabe » Thu Jul 30, 2015 6:16 pm

C:/micromacro/scripts/rom/functions.lua:797: bad argument #1 to 'memoryReadByte' ((null))

This error seems to be timing doing what I posted on the previous msg so far seems to temporally fix it. Hopefully rock can figure why. I patched 1 pc and the other kept getting error but the one I patched ran normal after.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: CPU freq.

#17 Post by rock5 » Fri Jul 31, 2015 1:26 am

Administrator does everything in regards to micromacro. She'll need to answer. How did you patch it? What did you change?
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
Administrator
Site Admin
Posts: 5306
Joined: Sat Jan 05, 2008 4:21 pm

Re: CPU freq.

#18 Post by Administrator » Fri Jul 31, 2015 1:03 pm

I'm a bit confused here. Line 797 of functions.lua is as follows:

Code: Select all

while( memoryReadByte(getProc(), macro_address + addresses.macroSize *(resultMacro - 1) + addresses.macroBody_offset) == 6 ) do
There's no use of the frequency there. In fact, the only use of the frequency anywhere in the bot that I could find was in relation to skill cast times. I'm not sure I could see the frequency calculation causing any nil errors anywhere.

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: CPU freq.

#19 Post by beanybabe » Sat Aug 01, 2015 12:26 am

i'm not sure why but when I change that number the error stops happening. It happened on 2 machines when I changed the error has not occurred. The code is a bit mystic to me in that area way over my head.
Your formula looks correct.

976.56075 number = (getTimerFrequency().low /rated cpu freq )*1000 open windows do a properties on my computer see what the frequency is and put it in were rated cpu freq is. the number seems to be different for each pc.
It may just be a coincidence but i'm confident you can figure it out.

here is what I did
if( getTimerFrequency ) then
-- Grab the real frequency instead of calculating it, if available
bot.GetTimeFrequency = getTimerFrequency().low / 976.56075; ------------- I change this number
else
-- calculate the CPU Frequency / used for manipulation the GetTime() values
local calc_start = getTime();
yrest(1000);
local calc_end = getTime();
bot.GetTimeFrequency = (calc_end.low - calc_start.low) / 976.56075; ------------- I change this number
end

User avatar
Administrator
Site Admin
Posts: 5306
Joined: Sat Jan 05, 2008 4:21 pm

Re: CPU freq.

#20 Post by Administrator » Sun Aug 02, 2015 1:15 am

I think it maybe just has to do with timing. Lowering that number should cause your skills to delay slightly longer. Perhaps at a higher polling rate, it tries to access some data faster than it is being written to by the game, and that is causing some issue somewhere.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 36 guests