See if your system is jerky

BlitzMax Forums/BlitzMax Beginners Area/See if your system is jerky

Grey Alien(Posted 2007) [#1]
Hi, inspired buy TonyG's thread ( http://www.blitzbasic.com/Community/posts.php?topic=69393 ) I have made a little program to see if your system will play BMax arcade games smoothly or with jerks.

Please compile and run this (WITH DEBUG MODE OFF).

As soon as it's been running for around a second press Space to reset the High value as sometimes the first few frames are not steady.

Or try this zip of Exes:

http://www.greyaliengames.com/misc/JerkTester.zip

'SetGraphicsDriver GLMax2DDriver()
Graphics 800,600,32
'Graphics 800,600,0

GCSetMode 2
Local t1:Int
Local t2:Int
Local test: Int
Local high: Int
While Not KeyHit(KEY_ESCAPE)
	t1=MilliSecs()
	Cls
	DrawText "Current: "+test,0,0
	DrawText "High:    "+high,0,20
	DrawText "Press <Space> to reset High",0,40
	DrawText "Press <Escape> to exit",0,60
    Flip 1	
	t2 = MilliSecs() 
	test:Int = (t2-t1) 
	If test>high Then high = test
	If KeyHit(KEY_SPACE) Then high = 0
Wend


[EDIT]
NEW GRAPH VERSION!

'SetGraphicsDriver GLMax2DDriver()
Graphics 800,600,32
'Graphics 800,600,0

Local t1:Int
Local t2:Int
Local test: Int
Local high: Int
Const MAXVALUES=800
Local values:Int[MAXVALUES]
Local counter=0

While Not KeyHit(KEY_ESCAPE)
	t1=MilliSecs()
	Cls
	DrawText "Current: "+test,0,0
	DrawText "High:    "+high,0,20
	DrawText "Press <Space> to reset High",0,40
	DrawText "Press <Escape> to exit",0,60
'	DrawText GCMemAlloced(),0,80
	For Local i=0 To MAXVALUES-2
		DrawLine i,500-values[i],(i+1),500-values[i+1]
	Next
    Flip 1	
	t2 = MilliSecs() 
	test:Int = (t2-t1) 
	If test>high Then high = test
	If KeyHit(KEY_SPACE) Then high = 0
	values[counter] = test
	Counter:+1
	If counter>=MAXVALUES Then counter = 0
Wend


This version shows a graph. You will always get a rough patch for around 200 pixels as the system stabilises but after that it should only fluctuate by 1-2 pixels at the most.

After that you should see Current fluctuating around the 16/17/18 mark and High may go up to 18, assuming your display is running at 60Hz full screen. If you display runs at different Hz then you'll get a different value but the point is that it should be in the teens and not-fluctuate.

If High goes ANY higher then you may have a jerky system. Press space a few more times and see if it was a one off or if it goes higher than 18.

You can also try the same in OpenGL by uncommenting the top line of code. I'd be interested to find out the results on a Max and in Linux...

Also you can try windowed mode.

You might want to try with flip 0 as well.

Anyway my machine is not jerky. Please post system specs:

P4 3.2GHz HT, 1GB RAM, Radeon 9800XT, SB Audigy2, XP Home SP2

Thanks!!!


Grey Alien(Posted 2007) [#2]
OK my Intel MacBook Pro is rock steady in full-screen and windowed mode but with the odd jerk if the OS accesses the harddisk for something.


tonyg(Posted 2007) [#3]
W2K S3 Laptop :
OGL 9 with high 30
DX 17 with high 30-50
.
Not sure if it helps but using FLIP 0 shows :
OGL 9 with high 24.
DX 7 with High 10.

<edit> In your tests I think you're doing a lot of memory allocation with the drawtext commands but not sure why it would 'spike'.


Matty(Posted 2007) [#4]
Grey - would it be a problem to make an exe (or several for the different cases) available of this? I'm curious to test but don't own blitzmax.


Grey Alien(Posted 2007) [#5]
tonyG: Hmm, you have a pretty crappy high value there then as if you card never goes above 30 FPS. Presume that was in full-screen mode. Also Flip 0 performance is not good.

Re: memory allocation, well does it make any difference with GCSetMode commented out? Anyway DrawText is a pretty minor amount of memory allocated compared to a real game.

I have heard speculation before that when the allocated memory has to span a page boundary it can slow down but not sure about the details and if it's true.

Matty: Preparing now...


Grey Alien(Posted 2007) [#6]
Matty: Exes link in top post.


tonyg(Posted 2007) [#7]
Windowed mode shows 17 High 19.
The 'high' values seem to be occur on intermittent runs of the code. In this case it might be a background task as I haven't got a control case to check against.


TomToad(Posted 2007) [#8]
I've been noticing a glitch in BMax programs lately that wasn't there before. I'm not exactly sure when the glitch appeared and assumed it was something I installed.
With your test program, I'd get a high of about 70, but if I let it run long enough, it will reach over 100.
AMD athalon XP 2800+ 2.1 GHZ, 512 MB RAM, NVidia GeForce FX 5200, Viewsonic VG1930wm flat panel hooked to VGA, not DVI.


Azathoth(Posted 2007) [#9]
DirectX high was between 17-18
OpenGL high was also around 17 but when it first started was 72

The computer specs are P4 3Ghz HT, 3GB, GeForce 7800 GS CO, SB Audigy 4, XP Home SP2


Grey Alien(Posted 2007) [#10]
interesting.

TonyG: Are you saying that 19 is your high value as that's not very high.

TomToad, yeah that shows something is interfering in the background for sure.

Azathoth: It's always high at the start, you need to wait a second before pressing space.

PLEASE TRY OUT MY GRAPH VERSION ABOVE.


Grey Alien(Posted 2007) [#11]
So far the Pentiums are smooth and the Athlons aren't, but it's too early to make assessments.


tonyg(Posted 2007) [#12]
TonyG: Are you saying that 19 is your high value as that's not very high.

I don't think I have a problem on my laptop.
The test I posted in my thread works fine on my laptop and the results from your tests are intermittent with
normal values between 17-19. I suspect the 'higher' values in my case were background processes.

<edit> My other tests suggested it was the CLS/FLIP which causes the jump in cycletime.


Grey Alien(Posted 2007) [#13]
When can you test on your WinXP Athlon system?


Azathoth(Posted 2007) [#14]
With the graph version DX creeps up to 20 and OGL usually stays around 18-19 but sometimes jumps to 29


tonyg(Posted 2007) [#15]
Not for a few hours BUT my other post shows the results I was getting and the control case I ran.
@TomToad, I think you're in the best position to reproduce. Can you check if the same spike is shown with the following :
'SetGraphicsDriver GLMax2DDriver()
'Graphics 800,600,32
Graphics 800,600

GCSetMode 2
Local t1:Int
Local t2:Int
Local test: Int
Local high: Int
While Not KeyHit(KEY_ESCAPE)
	t1=MilliSecs()
'	Cls
'	DrawText "Current: "+test,0,0
'	DrawText "High:    "+high,0,20
'	DrawText "Press <Space> to reset High",0,40
'	DrawText "Press <Escape> to exit",0,60
'    Flip 0
	t2 = MilliSecs() 
	test:Int = (t2-t1) 
	If test > high 
		high = test
		Print high
	EndIf
	If KeyHit(KEY_SPACE) Then high = 0
Wend



Grey Alien(Posted 2007) [#16]
My laptop has an almost regular jerk in windowed mode (high=34) + it takes a long time to settle down. It's jerky in full-screen too.

Specs: P4 2.4, 1GB, XP Home SP2, SiS M60 graphics (probably rubbish)


TomToad(Posted 2007) [#17]
Weird, whenever I get a spike, it is followed by a sudden dip. In other words, it averages about 16-17, but when it goes over that, then it dips to 0-5 a few frames until it averages back out. Maybe it has something to do with the buffer ahead, except that I get the same thing with both DirectX and OpenGL.
Also, I tried shutting down any backgroup tasks that I could. Now the spikes accur at around 55-60. I think the over 100 spikes were due to some process, but now it seems to be all BlitzMAX.
These modifications to your test program shows that the average remains at 17 regardless of the number and height of the spikes



Grey Alien(Posted 2007) [#18]
TonyG: How does your code posted above work for you? Any highs?


TomToad(Posted 2007) [#19]
Just tried TonyG's code, I get a high of 28. That's with all the unnecessary processes turned off. I'd need to reboot to see how it behaves in my normal enviroment, But I'll be leaving for work in 5 minutes, so I'll save it for tonight.


tonyg(Posted 2007) [#20]
TonyG: How does your code posted above work for you? Any highs?

With that code on my laptop I get highs of 1-2.
I also ran it printing test and it was nearly always 0 with the occasional 1-2.
This same test ran on my desktop (sig) machine was showing highs of 50 or so.


H&K(Posted 2007) [#21]
Aspire 30000, some Atherlon

Lots of spikes with internet on. Turned internet off Smooth


Grey Alien(Posted 2007) [#22]
more interesting results. Anyway, if the jerks can't be removed from end user systems then they have to be smoothed out with arcade game code by some kinda "catchup" code instead of an immediate "hard" shift of game objects by delta. I'm gonna look into this, but I need a crappy machine to test it on...


TaskMaster(Posted 2007) [#23]
By commenting out the flip, haven't you removed the return to the system?


Grey Alien(Posted 2007) [#24]
TomToad: Just saw your code. Ran it. I get High 18, Low 15, Average 16. Never changes...


tonyg(Posted 2007) [#25]
@GA, Isn't that because your machine doesn't suffer the suspected problem?


Grey Alien(Posted 2007) [#26]
uh yeah. sorry but mine's a good control.


Wiebo(Posted 2007) [#27]
I'm more concerned about other people's machines instead of mine :)


degac(Posted 2007) [#28]
FullScreen 18
OpenGL Fullscreen 17
Windowed 18

Athlon X2 3800+ 2.0 ghz, 1gb ram, GeForce 6600


Perturbatio(Posted 2007) [#29]
Using TomToad's

On my desktop:
Low 15
Average 16
High 18

laptop (celeron 1.4GHz, 512MB Ram, 8MB shared graphics)
Low 48
Average 49
High 71


Grey Alien(Posted 2007) [#30]
Thanks for the stats, so two good Athlons there but a not so good laptop!


Matty(Posted 2007) [#31]
Sorry about the delay Grey I just tested the three executables and got the following results:

JerkTesterWindowed:Current - hovering around 18, high - usually 18 or 19 although a couple of times 33 (rarely)

JerkTesterFullScreen:Current - 17/18, High - 17/18/19 although a couple of times it went to 39/71 but very rarely.

JerkTesterOpenGLFullScreen - 17/18 , High - 17/18/19

All three applications were much the same.

My machine is a laptop, Asus A4K with an AMD processor (3500+ or something that runs at 2Ghz approx), ATI Vid Card 9700 Mobility Pro with its own 64MB RAM, System RAM of 512MB and Windows XP Pro. It is an AMD64 but I'm pretty sure the OS is just standard 32bit Windows XP.

Drivers are what it came with from the factory, I don't want to mess with that stuff.


Grey Alien(Posted 2007) [#32]
Thanks Matty. Seems that your system is pretty stable with the odd glitch due to background process so probably fine, cool :-)


degac(Posted 2007) [#33]
On the office computer
FS FPS 18
OpenGL FPS 17
Windowed 18

AthlonX2 4600+ 2.4 Ghz, 2 Gram, Geforce 6150LE


WendellM(Posted 2007) [#34]
Hi, Grey. Here's a slightly-reduced version of the "EKG" under XP. I pressed space a bit after startup and let the graph wrap once before capturing this (specs in sig):



It's better windowed:



OpenGL is pretty much the same as these, both fullscreen and windowed.

On the other hand, it's very smooth in fullscreen on my Mac: steady right at 16/17 with a high of 17 (after pressing space to clear the startup spike). Windowed on the Mac is 11/12 with a high of 20 (about 1 tiny spike per graph wrap).


Grey Alien(Posted 2007) [#35]
WendellM Hey that's great data thanks! The graph tells a good story. Anyway it seems that most of the time an action game would be smooth on yours but with the odd blip which is worse in full-screen mode (but nothing really serious). Possibly due to full-screen mode higging more CPU power or something. Good to hear the Mac is smooth.


tonyg(Posted 2007) [#36]
Oddly that graphic from WendellM is what I see intermittently and specifically the little build up before the spike. I assumed that it MUST have been a Windows background process.


TomToad(Posted 2007) [#37]
I've noticed that Blitz3D is also jerky.
Other programs run smooth without any problems.
It seems Blitz became jerky around about the same time I switched CPUs. My roommate's motherboard broke and so he went and got a new system. He gave me his old CPU. So I went from an AMD Athalon XP 2400+ to an AMD Athalon XP 2800+.
I don't know for sure if that is the problem because I can't seem to remember where I put the old CPU to try it out.

Regardless, the fact that all my non-Blitz games run just fine points to a problem with Blitz. Maybe it's calling an API or something that doesn't like certain CPUs.


Grey Alien(Posted 2007) [#38]
so all you changed was the CPU and nothing else? weird. I don't know what it is, if it's a blitz thing or not. It's there though, so I need to find some kind of workaround.


TaskMaster(Posted 2007) [#39]
I do not see a jerk unless I do something on my system outside of the Blitz program.

Make the mouse change shape, minimize a window, maximize a window, etc.


TomToad(Posted 2007) [#40]
I can't say if it's the CPU or if it's something else. I just know that the jerkiness started at about the time I swapped the CPUs. I put my old CPU away somewhere and haven't had a whole lot of time to look for it. Until I find it and can swap it back in, I won't know for sure if that's the problem or not.
Also, getting rid of unneeded background tasks do nothing to help. I get the jerk in about one second time intervals.


xlsior(Posted 2007) [#41]
Low 15
Average 16
High 18

Core 2 Duo E6600, Radeon X1650XT


Grey Alien(Posted 2007) [#42]
TomToad. Yeah it's that regular jerking thing that some people get which is weird.

xlsior: thanks.