mIRC Home    About    Download    Register    News    Help

Print Thread
#158036 31/08/06 06:15 AM
Joined: Aug 2006
Posts: 22
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Aug 2006
Posts: 22
Not noticing any with process explorer, but figured I'd ask anyway as it just seems like it should gobble up 100% of the cpu.

Okay here's the thing. I need to change one hash value if some different values change. So I tried making a 0 second timer that repeats forever thinking, since, it's time to run it again right after it executes, it's run up 100% of the cpu.

Here's the thing. It don't. confused

I'm not complaining as that simplifies my life dramatically smile, but why? My guess is 0 doesn't actually mean 0.

Anyway anything I should watch out for using it as a means to monitor a hash value? I keep seeing this nightmare scenario where unforeseen things make the cpu usage shoots up to 100% shocked

Last edited by netsplit; 31/08/06 06:19 AM.
Joined: Aug 2006
Posts: 22
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Aug 2006
Posts: 22
nvm answered this myself with /timer

Quote:

* Active timers:
* Timer watchhash 1ms delay checkhash


sweet! laugh

Last edited by netsplit; 31/08/06 06:36 AM.
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Just in case you didn't find it, noting your quote, you can use the -m switch to create a millisecond timer.
/timer -m 0 1 <command>

I wouldn't recommend anything too extensive for the <command> section, as it will be called eveery millisecond (1000 times per second).

Please note that while this is as accurate as you can get, there is a chance that it won't execute exactly on the millisecond, so that you might get (for example) 950 calls per second versus 1000.

If it's important that you get the correct timing, add the -c switch,

As you noted, /help /timer has all this (and more) information.

Joined: Aug 2006
Posts: 22
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Aug 2006
Posts: 22
Cool swapped in a 1 and a -m. Makes the code less hackish, and all around good to know. Thanks.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I hope you put the 1 in the same location I have it in my example, because if you put it in place of the 0, then your timer is only going to execute once, but you probably aleady know that, as you started off talking about a repeating timer. The 0 (as I have it) means that the timer will repeat indefinetely until it's turned off

Joined: Aug 2006
Posts: 22
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Aug 2006
Posts: 22
It's working fine thanks. Added a -o to it too to stop from quiting on disconnect.

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
Please note that while this is as accurate as you can get, there is a chance that it won't execute exactly on the millisecond, so that you might get (for example) 950 calls per second versus 1000.


Infact you cant get more than 64 calls per second, this is the cycle rate that timers are checked for if they have reached/passed there execution due time

//set %a 1 | set %b 0 | timerA -m 0 1 inc %a | timerB 0 1 echo -at Event count $!calc(%a - % $+ b) total events now % $+ a $(|,) set %b % $+ a
[12:04:26.485] Event count 106 total events now 106
[12:04:27.485] Event count 64 total events now 170
[12:04:28.485] Event count 64 total events now 234
[12:04:29.485] Event count 64 total events now 298
[12:04:30.485] Event count 64 total events now 362
[12:04:31.485] Event count 64 total events now 426
[12:04:32.485] Event count 64 total events now 490
[12:04:33.485] Event count 64 total events now 554
[12:04:34.485] Event count 64 total events now 618

Ignore the first one, thats due to syncing problems with when the once per second timer goes off, following that as you can see the result is 64 events per second.

* this is NT, win9x might have a different rate im not sure.

Joined: Aug 2006
Posts: 22
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Aug 2006
Posts: 22
Tried your code, clever by the way, and got

[21:46:37] Event count 148 total events now 148
[21:46:38] Event count 98 total events now 246
[21:46:39] Event count 100 total events now 346
[21:46:40] Event count 100 total events now 446
[21:46:41] Event count 100 total events now 546
[21:46:42] Event count 100 total events now 646
[21:46:43] Event count 100 total events now 746
[21:46:44] Event count 100 total events now 846

This is on windows 2003.

So does it seem to very between OSes. Might have something to do with what the server or work station flag is set at.

Still way too quick for something to sneak in and mess it up.

One follow up question. How do I start/stop timers without the echo?

Last edited by netsplit; 01/09/06 01:57 AM.
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
on WinXP (both Home and Pro), I got
Quote:
[22:06:58] Event count 64 total events now 1233
[22:06:59] Event count 64 total events now 1297
[22:07:00] Event count 64 total events now 1361
[22:07:01] Event count 63 total events now 1424
[22:07:02] Event count 64 total events now 1488
[22:07:03] Event count 64 total events now 1552
[22:07:04] Event count 64 total events now 1616
[22:07:05] Event count 64 total events now 1680
[22:07:06] Event count 63 total events now 1743
[22:07:07] Event count 63 total events now 1806
[22:07:08] Event count 64 total events now 1870
[22:07:09] Event count 64 total events now 1934
[22:07:10] Event count 64 total events now 1998
[22:07:11] Event count 64 total events now 2062
[22:07:12] Event count 64 total events now 2126
[22:07:13] Event count 64 total events now 2190
[22:07:14] Event count 64 total events now 2254
[22:07:15] Event count 64 total events now 2318
[22:07:16] Event count 64 total events now 2382
[22:07:17] Event count 62 total events now 2444
[22:07:18] Event count 63 total events now 2507
[22:07:19] Event count 64 total events now 2571
[22:07:20] Event count 64 total events now 2635


Regarding starting and stopping timers without the echo, use .timer rather than timer or /timer

Joined: Aug 2006
Posts: 22
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Aug 2006
Posts: 22
used ntswitch to convert 2003 to winxp proffessional and got

[1:17:33] Event count 100 total events now 100
[1:17:34] Event count 99 total events now 199
[1:17:35] Event count 100 total events now 299
[1:17:36] Event count 100 total events now 399
[1:17:37] Event count 100 total events now 499
[1:17:38] Event count 100 total events now 599
[1:17:39] Event count 99 total events now 698
[1:17:40] Event count 100 total events now 798
[1:17:41] Event count 100 total events now 898
[1:17:42] Event count 100 total events now 998
[1:17:43] Event count 100 total events now 1098

So it's purely kernel version based.

Last edited by netsplit; 01/09/06 05:23 AM.
Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
XP Pro

Quote:
* Timer a activated
* Timer b activated
[9:47AM] Event count 79 total events now 79
[9:47AM] Event count 64 total events now 143
[9:47AM] Event count 63 total events now 206
[9:47AM] Event count 64 total events now 270
[9:48AM] Event count 63 total events now 333
[9:48AM] Event count 64 total events now 397
[9:48AM] Event count 64 total events now 461
[9:48AM] Event count 64 total events now 525
[9:48AM] Event count 64 total events now 589
[9:48AM] Event count 63 total events now 652
[9:48AM] Event count 64 total events now 716
[9:48AM] Event count 63 total events now 779
[9:48AM] Event count 49 total events now 828
[9:48AM] Event count 111 total events now 939
[9:48AM] Event count 64 total events now 1003
[9:48AM] Event count 62 total events now 1065
[9:48AM] Event count 64 total events now 1129
[9:48AM] Event count 64 total events now 1193
[9:48AM] Event count 63 total events now 1256
[9:48AM] Event count 62 total events now 1318
[9:48AM] Event count 64 total events now 1382
[9:48AM] Event count 64 total events now 1446
[9:48AM] Event count 64 total events now 1510
* Timer a halted
* Timer b halted


billythekid
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
omg look at this, i was just trying it out on w2kserver, and i happened to click the FILE menu when it was running heres the results

[21:25:08.797] Event count 64 total events now 372
[21:25:09.797] Event count 64 total events now 436 clicked FILE menu sometime after this displayed
[21:25:10.422] Event count 39 total events now 475
[21:25:11.797] Event count 30 total events now 505
[21:25:12.797] Event count 30 total events now 535
[21:25:13.797] Event count 30 total events now 565
[21:25:14.797] Event count 30 total events now 595
[21:25:15.797] Event count 30 total events now 625
[21:25:16.266] Event count 30 total events now 655
[21:25:17.329] Event count 34 total events now 689 unclicked FILE menu sometime after this displayed
[21:25:18.797] Event count 38 total events now 727
[21:25:19.797] Event count 64 total events now 791
[21:25:20.797] Event count 64 total events now 855
[21:25:21.797] Event count 64 total events now 919

Assumption is that something starts eating alot of proccessor cycles just to have the drop menus up.

Ignoring what i showed above 2000 server seemed to come back with 64 a second normally, havent tried it on anything newer (than xp), from memory i think this might be to do with time slicing/cycling between applications running, I havent got the utility here to adjust the process threads priority, but i would assume if it was increased it likely would get more cycles

Joined: Apr 2005
Posts: 9
A
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
A
Joined: Apr 2005
Posts: 9
Same thing: 64 becomes 30 when opening a menu or a popup.
But the funny thing is - it still remains 63-64 even when I turn on a CPU benchmark (SuperPI) that loads 100% of the CPU.
(Windows XP)

Joined: Sep 2006
Posts: 1
I
Mostly harmless
Offline
Mostly harmless
I
Joined: Sep 2006
Posts: 1
Hey... i can stop the timers ?... and what's the timers command to say line every 5 minutes ? :|

Joined: Aug 2006
Posts: 22
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Aug 2006
Posts: 22
iZap just type /help /timer and scroll down to timers and it'll tell ya all you need to know.


Anyway some more tests on server 2003

Code:
file menu open
[18:21:30] Event count 100 total events now 1048
[18:21:31] Event count 95 total events now 1143
[18:21:32] Event count 78 total events now 1221
[18:21:33] Event count 56 total events now 1277
[18:21:34] Event count 50 total events now 1327
[18:21:35] Event count 55 total events now 1382
[18:21:36] Event count 48 total events now 1430
[18:21:37] Event count 56 total events now 1486
[18:21:38] Event count 46 total events now 1532
[18:21:39] Event count 56 total events now 1588
[18:21:40] Event count 44 total events now 1632
[18:21:41] Event count 54 total events now 1686
[18:21:43] Event count 75 total events now 1761
[18:21:44] Event count 97 total events now 1858
[18:21:45] Event count 99 total events now 1957
[18:21:46] Event count 98 total events now 2055
file menu off

Confirming the file menu does cost timers.

suspend it with process explorer
[18:25:22] Event count 89 total events now 2640
[18:25:23] Event count 87 total events now 2727
[18:25:35] Event count 97 total events now 2824
[18:25:37] Event count 136 total events now 2960
[18:25:38] Event count 94 total events now 3054
[18:25:39] Event count 95 total events now 3149

So suspend seems to work.

start with priority set at real time 
[18:27:18] Event count 98 total events now 724
[18:27:19] Event count 95 total events now 819
[18:27:20] Event count 91 total events now 910
[18:27:21] Event count 91 total events now 1001
[18:27:22] Event count 90 total events now 1091
[18:27:23] Event count 95 total events now 1186
[18:27:24] Event count 95 total events now 1281
[18:27:25] Event count 95 total events now 1376
[18:27:26] Event count 91 total events now 1467
[18:27:27] Event count 95 total events now 1562
[18:27:28] Event count 93 total events now 1655
[18:27:29] Event count 95 total events now 1750
[18:27:30] Event count 95 total events now 1845
ended with priority at "idle"

Priority doesn't seem to affect it. Maybe if it had to compete for cpu resources.


timer ran while opening the start panel a bunch of times
[18:29:11] Event count 94 total events now 622
[18:29:12] Event count 91 total events now 713
[18:29:13] Event count 91 total events now 804
[18:29:14] Event count 88 total events now 892
[18:29:15] Event count 91 total events now 983
[18:29:16] Event count 93 total events now 1076
[18:29:17] Event count 91 total events now 1167
[18:29:18] Event count 88 total events now 1255
[18:29:19] Event count 97 total events now 1352
[18:29:20] Event count 99 total events now 1451
[18:29:21] Event count 91 total events now 1542
[18:29:22] Event count 95 total events now 1637

other menus don't seem to affect it.

timer while opening the classic start menu a bunch of times
[18:30:28] Event count 94 total events now 7647
[18:30:29] Event count 91 total events now 7738
[18:30:30] Event count 93 total events now 7831
[18:30:31] Event count 93 total events now 7924
[18:30:32] Event count 90 total events now 8014
[18:30:33] Event count 91 total events now 8105
[18:30:34] Event count 91 total events now 8196
[18:30:35] Event count 92 total events now 8288
[18:30:36] Event count 97 total events now 8385
[18:30:37] Event count 90 total events now 8475
[18:30:38] Event count 93 total events now 8568


My theory was mIRC for some reason uses timers in it's menus (maybe to keep track of mouse position\activity?). Since mIRC and it's script use the same pool of timers when mIRC takes em out for it's menus the difference is subtracted from what's available to the scripts.

Except one problem

I set timerc which also incriments %a and got

Code:
[18:44:36] Event count 189 total events now 87546
[18:44:37] Event count 102 total events now 87648
[18:44:38] Event count 186 total events now 87834
[18:44:39] Event count 188 total events now 88022
[18:44:40] Event count 188 total events now 88210
[18:44:41] Event count 188 total events now 88398
[18:44:43] Event count 188 total events now 88586
[18:44:44] Event count 250 total events now 88836
[18:44:45] Event count 178 total events now 89014
[18:44:46] Event count 190 total events now 89204
[18:44:47] Event count 196 total events now 89400
[18:44:48] Event count 186 total events now 89586
[18:44:49] Event count 132 total events now 89718

The drop in counts at the bottom is from opening mIRC menus.

then I increased it from idle to realtime and got
[18:46:16] Event count 176 total events now 105315
[18:46:17] Event count 176 total events now 105491
[18:46:18] Event count 178 total events now 105669
[18:46:19] Event count 194 total events now 105863
[18:46:20] Event count 196 total events now 106059
[18:46:21] Event count 196 total events now 106255
[18:46:22] Event count 193 total events now 106448


So it appears mIRC can get more timers if it wants. It just doesn't. Not a big deal Few are gonna timers that quick anyway.

conclusion: mIRCs weird.

Joined: Aug 2006
Posts: 22
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Aug 2006
Posts: 22
One last update.

used
//var %i = 0 | while (%i < 125) { | inc %i | timer $+ %i -m 0 1 inc %a | }

Played with different amounts of timers and 125 incrementers seems to be the one to get the highest hits per second
[19:23:32] Event count 11718 total events now 412020
[19:23:33] Event count 11592 total events now 423612
[19:23:34] Event count 11466 total events now 435078
[19:23:35] Event count 11340 total events now 446418
[19:23:36] Event count 11592 total events now 458010
[19:23:37] Event count 11718 total events now 469728

However it bogged down the computer horribly.

Revised conclusion. mIRC isn't weird, just has a nice antibogging feature. Still don't understand why kernel version should matter though.

Last edited by netsplit; 03/09/06 11:30 PM.

Link Copied to Clipboard