Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (590)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Profiling an Applet  (Read 2189 times)
0 Members and 1 Guest are viewing this topic.
Offline crystalsquid

Junior Devvie




... Boing ...


« Posted 2004-11-29 13:13:31 »

Having downloaded & (unsucesfully) tried several profilers today, I am resorting to picking someone else brains on this one:

How can I profile my applet, seeing as it WONT run in appletviewer?

I can debug it fine (jswat connect to running VM, sweet!) but I can't find a profiler that can do the same. or at least I can't get one to work!

- Dom
Offline Absolution

Senior Newbie




Java games rock!


« Reply #1 - Posted 2004-11-29 17:26:05 »

hmm

appletviewer -J-Xprof index.html
Offline crystalsquid

Junior Devvie




... Boing ...


« Reply #2 - Posted 2004-11-29 18:56:50 »

It doesn't run in appletviewer sadly Sad
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Malohkan

Senior Devvie




while (true) System.out.println("WOO!!!!");


« Reply #3 - Posted 2004-11-29 20:18:47 »

what kind of an Applet doesn't run in AppletViewer?  Sounds like you've got some problems to sort out before you profile Tongue

Admin and Game Developer at
GameLizard.com
Play Rimscape!    |    Play Conquer!
Offline crystalsquid

Junior Devvie




... Boing ...


« Reply #4 - Posted 2004-11-30 07:40:31 »

There are various reasons. We use a srange page with javascript (to show a pre-loading box, or 'you don't have Java' messages) as well as server access control to the resources. Sufficed to say it works fine in a browser, and the closest AppletViewer comes to running it is this error:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
Exception in thread "main" java.util.MissingResourceException: Can't find resour
ce for bundle sun.applet.resources.MsgAppletViewer, key appletpanel.badattribute
.exception
        at java.util.ResourceBundle.getObject(ResourceBundle.java:314)
        at java.util.ResourceBundle.getString(ResourceBundle.java:274)
        at sun.applet.AppletMessageHandler.getMessage(AppletMessageHandler.java:
39)
        at sun.applet.AppletPanel.showAppletStatus(AppletPanel.java:701)
        at sun.applet.AppletPanel.init(AppletPanel.java:185)
        at sun.applet.AppletViewer.<init>(AppletViewer.java:175)
        at sun.applet.StdAppletViewerFactory.createAppletViewer(AppletViewer.jav
a:80)
        at sun.applet.AppletViewer.parse(AppletViewer.java:1062)
        at sun.applet.AppletViewer.parse(AppletViewer.java:996)
        at sun.applet.Main.run(Main.java:138)
        at sun.applet.Main.main(Main.java:80)


Seeing as the debugger can happily connect to the VM when it is running, I was kind of hoping one of the many profilers out there would be able to do the same. JProbe has some comments on the site about doing this, but when I try with the latest version I just get an full-on access violation from IE.
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #5 - Posted 2004-11-30 09:10:39 »

Quote
Sounds like you've got some problems to sort out before you profile Tongue


I've said much the same before, admittedly because I don't have the java plugin installed Grin (makes pages load quicker and conserves more memory; also makes mozilla noticeably more stable, sad but true! My OS-crashes from mozilla have gone down by a factor of 5 since I stopped installing the java plugin).

Appletiviewer dies on some situations where it shouldn't really do so (e.g. if there's any problem with the certificate it simply quits/throws uncaught exceptions without even an error message), but java version checkers are the only thing I've ever seen that wasn't eventually fixable to work with appletviewer (it usually dies because there's a recoverable problem it can't be bothered to recover from; fix all your problems and it runs).

Another example is obfuscators, most of which are broken and shouldn't be used. Frequently, their bugs kill appletviewer, but a better obfuscator and/or not using one fixes that Grin.

So...until Sun fixes appletviewer's many bugs there will continue to be plenty of people who cannot run their applets with it. Although I personally think you shouldn't distribute applets like this, they're not technically breaking the java spec (appletviewer COULD work if Sun chose to make it adhere to their own specs and actually handle their own exceptions!), and they shouldn't be left out in the cold. Sad.

In the meantime, can't you just make an extra build with your build system that doesn't include the java-check stuff that is killing appletviewer? Surely it would be sufficient to profile the applet without that bit?

malloc will be first against the wall when the revolution comes...
Offline Absolution

Senior Newbie




Java games rock!


« Reply #6 - Posted 2004-11-30 14:02:16 »

I was about to say the same thing - just make a special build.  For most of my projects it's not even that difficult to convert it to an application.  Incidentily, my latest profile shows that my renderer spends about 60% of the time in the pixel renderer.  Tongue

I've found the same problem with obfuscators.   I tried using proguard to reduce the size of my jar, but couldn't get it to work reliably.  I can't remember the exact errors (something to do with init).  
Offline crystalsquid

Junior Devvie




... Boing ...


« Reply #7 - Posted 2004-11-30 16:00:41 »

I was hoping to avoid fiddling about to get a version that works with appletviewer Sad

Seeing as the dubugger could connect to a running VM, I was sort of hoping at least one profiling tool out there could do the same. Doesn't sound like anyone knows of one tho Sad
Offline crystalsquid

Junior Devvie




... Boing ...


« Reply #8 - Posted 2004-12-07 09:26:56 »

Finally got it working in appletviewer, and profiled it.
Now I remember why I dislike trying to tune Java Sad
Results:
Quote
1 [root] 0 (  0%) 2495 (100%)
2 void Thread.run () 0 (  0%) 2410 ( 96%)
3 void WToolkit.run () 1 (  0%) 2101 ( 84%)
4 void WToolkit.eventLoop () 2100 ( 84%) 2100 ( 84%)
5 void CSApplet.run () 1 (  0%) 274 ( 10%)
6 boolean CSApplet.render () 0 (  0%) 148 (  5%)
7 boolean DrawImage.copyImage (SunGraphics2D, Image, int, int, int, int, int, int, Color, ImageObserver) 0 (  0%) 145 (  5%)


So... 10% spent in my applets run, and 84% in WToolkit.eventloop.

After a fruitless morning googling for what this might be, I have come to the conclusion that either:
a) The profiler is lying.
b) Its telling the truth, and noone knows what this eventloop is doing or how to get it to stop Sad

What is most disturbing is that it runs at exactly the same speed ( 30fps and it should be 50fps) on my 2.4GHz machine, AND on the PII 400MHz low spec machine!! Much wierdness...

Any help in understanding what is goping on would be greatly appreciated Smiley

- Dom
Offline princec

« JGO Spiffy Duke »


Medals: 422
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #9 - Posted 2004-12-07 10:03:04 »

I'm sure this exact problem has been seen before, and it's something to do with the way the graphics pipeline is synced and flushed in the windows event loop. Such that it's never going to be faster than 30Hz.

Cas Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline crystalsquid

Junior Devvie




... Boing ...


« Reply #10 - Posted 2004-12-07 10:26:10 »

I use pretty much the same applett class in my 3D renderer, and that manages 50fps (theres nothing else going on though - no sound etc.). Not sure what else is different, but something Im doing is causing the event loop to fill up.
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #11 - Posted 2004-12-07 14:27:55 »

Quote

So... 10% spent in my applets run, and 84% in WToolkit.eventloop.

After a fruitless morning googling for what this might be, I have come to the conclusion that either:
a) The profiler is lying.
b) Its telling the truth, and noone knows what this eventloop is doing or how to get it to stop Sad



I've had exactly the same problem before, and eventually decided the only "solution" was to stop using AWT, either just for events or for events and rendering. On linux, I would get the same problem but with a completely different method call and library (yet with enough similarity you can guess it's a similar thing) and usually with much less disappearing into it - although sometimes it would be even worse.

My memory is that ceasing to use events for any input cleared it out (i.e. it was a problem with keyboards and mice rather than rendering - although I was never entirely convinced).

Sorry not to help more, I can only sympathise with your plight (and would dearly like to know more about these impenetrable massive CPU hogs in platform-specific code in the JVM's...!)

malloc will be first against the wall when the revolution comes...
Offline crystalsquid

Junior Devvie




... Boing ...


« Reply #12 - Posted 2004-12-07 19:19:35 »

Well Ive made it a better (>40fps)

Only I don't know how  :-/

Maybe the rebuild all fairy granted my wish...  Grin

Edit: the AWT mouse is definately a bit squiffy. Wiggle the mouse over the applet and CPU usage goes up by 10%!
Offline princec

« JGO Spiffy Duke »


Medals: 422
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #13 - Posted 2004-12-08 07:07:19 »

This is why we invented LWJGL :/

Cas Smiley

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

trollwarrior1 (33 views)
2014-11-22 12:13:56

xFryIx (73 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50

digdugdiggy (46 views)
2014-11-12 21:10:15

digdugdiggy (40 views)
2014-11-12 21:09:33

kovacsa (65 views)
2014-11-07 19:57:14

TehJavaDev (69 views)
2014-11-03 22:04:50

BurntPizza (68 views)
2014-11-03 18:54:52

moogie (82 views)
2014-11-03 06:22:04

CopyableCougar4 (82 views)
2014-11-01 23:36:41
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!