User Control Panel
Advertisements

HELP US, HELP YOU!

Net::Oscar use a huge amount of CPU?

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Modules & Add-ons
View unanswered posts
Author Message
freakk
Newbie
Newbie


Joined: 16 Aug 2005
Posts: 13

Reputation: 9.1Reputation: 9.1Reputation: 9.1Reputation: 9.1Reputation: 9.1Reputation: 9.1Reputation: 9.1Reputation: 9.1Reputation: 9.1

PostPosted: Mon Aug 22, 2005 8:57 am    Post subject: Net::Oscar use a huge amount of CPU? Reply with quote

Hello
I'm doing some tests with Net::Oscar module..

I've rewritten my bots to use Net::Oscar instead of Net::Aim module..
Everything works fine, except bots now uses more CPU's..
When I ran 10 bots at same time, total user CPU is 10-15%..
I've checked my code, nothing strange, so believe problem is in Net::Oscar module.. for example, with Net::Aim 10 bots uses less than 2%..

Anyone know how to fix this issue?

Thanks
Back to top
malefactor
Member
Member


Joined: 27 Jan 2005
Posts: 109
Location: Lewiston, ME
Reputation: 17.7Reputation: 17.7

PostPosted: Mon Aug 22, 2005 3:06 pm    Post subject: Reply with quote

well, you have three choices..

Upgrade your computer
Roll your own AIM module
Go back to net:AIM

though switching back may not be an option since it seems to me that its no longer compatible or something..
Back to top
eric256
The Keymaker
The Keymaker


Joined: 03 May 2006
Posts: 2292
Location: Colorado
Reputation: 47Reputation: 47Reputation: 47Reputation: 47Reputation: 47

PostPosted: Mon Aug 22, 2005 3:14 pm    Post subject: Reply with quote

I beleive that Oscar has always taken more CPU. I'm not sure 10-15% for 10 bots would realy concern me much though. Are you experiencing negative effects from this? If it is your regular computer you can always give the bot task a lower priority so it will slow down when you are low on CPU instead of slowing down whatever program you are using.

BTW most the time when there where CPU issues it is because your while (1) { } loop is going very fast. You might (emphasis on might) want to add a sleep statment in there so it loops slower. There are some high precision modules that will allow you to sleep for like 1/10th a second per loop, which could get rid of your 'problem'.

_________________
Eric256
Proud previous owner and current admin of Bot-depot.com
Back to top
mattaustin
Sentinel
Sentinel


Joined: 19 Jul 2004
Posts: 556
Location: Los Angeles, CA
Reputation: 50.7
votes: 1

PostPosted: Mon Aug 22, 2005 4:39 pm    Post subject: Reply with quote

some time i just sleep for 10 milliseconds with:

Code:
select(undef, undef, undef, 0.01);


in the while(1) loop..... this will slow it enough to lower the cpu without being noticeably slower on the bot.
Back to top
freakk
Newbie
Newbie


Joined: 16 Aug 2005
Posts: 13

Reputation: 9.1Reputation: 9.1Reputation: 9.1Reputation: 9.1Reputation: 9.1Reputation: 9.1Reputation: 9.1Reputation: 9.1Reputation: 9.1

PostPosted: Mon Aug 22, 2005 8:38 pm    Post subject: Reply with quote

Thanks for all your help..
I've added sleep (0.2 secs) inside while loop, also, set timout for do_one_loop to 0.1 (default value is 0.01)..
CPU usage is now less than 4%

Thanks again
Back to top
alienz
Almost An Agent
Almost An Agent


Joined: 22 Mar 2004
Posts: 1436
Location: Mars
Reputation: 55.7

PostPosted: Fri Aug 26, 2005 10:38 pm    Post subject: Reply with quote

I've also noticed increased CPU times if the Oscar server returns "Unknown extended info request". Anytime this error pops up at sign on for me, the CPU use goes through the roof after a few minutes. Reloading the bot usually fixes it, with no error the second time around.
_________________
Check out Botworld! A dev resource for things bot.
Downloads, articles, news, fourm and more.
http://botworld.marzopolis.com
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Sat Aug 27, 2005 1:28 am    Post subject: Reply with quote

I read somewhere that sleep takes an integer only unless you use a separate module with it.

i.e. "sleep .5;" would int to "sleep 0" and not sleep at all.

http://www.perl.com/pub/a/2004/12/29/3d_engine.html?page=2
Quote:
After watching these animations for a while, the jerkiness really begins to bother me, and because I doubled the number of animation frames, it takes twice as long to finish a run. Both of these problems relate to the second-long sleep at the end of draw_frame. I should be able to fix them by shortening the sleep to half a second:

sleep .5;

Chances are, that doesn't yield quite the respected result. On my system, there's a blur for a fraction of a second, and the whole run is done. Unfortunately, the builtin Perl sleep function only handles integer seconds, so .5 truncates to 0 and the sleep returns almost instantly.

Luckily, SDL provides a millisecond-resolution delay function, SDL::Delay. To use it, I add another subroutine to handle the delay, translating between seconds and milliseconds:

sub delay
{
my $seconds = shift;

SDL::Delay($seconds * 1000);
}

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
mattaustin
Sentinel
Sentinel


Joined: 19 Jul 2004
Posts: 556
Location: Los Angeles, CA
Reputation: 50.7
votes: 1

PostPosted: Mon Aug 29, 2005 3:54 pm    Post subject: Reply with quote

thats why i use select for my sleep....it sleeps in less than seconds....without useing another module..

just use:

select(undef, undef, undef, 0.01);

instead of sleep
Back to top
Mojave
Almost An Agent
Almost An Agent


Joined: 01 Nov 2003
Posts: 1434

Reputation: 66.4

PostPosted: Mon Aug 29, 2005 6:49 pm    Post subject: Reply with quote

I can't understand any of this, guess I didn't get enough select last night.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Modules & Add-ons All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group