Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (541)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (603)
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  
  Libgdx performance testing.  (Read 2064 times)
0 Members and 1 Guest are viewing this topic.
Offline trollwarrior1
« Posted 2014-01-17 06:33:27 »

Sooo how would I test performance in Libgdx? I mean, I can't really measure the time it takes to render, because I don't start/end the rendering process. I only "send" data to GPU or something like that. I don't "update" display and stuff like that. Are there methods built into Libgdx to test performance?

I tried measuring the time it takes to "render" my game. (you know, glclear, batch.begin, render, batch.end). With this, it takes ~300.00 something (1000000000 / 1000 seconds?). When I add my update game logic, it takes +2000.00 something.
Offline Longarmx
« Reply #1 - Posted 2014-01-17 14:37:54 »

What code are you using to calculate it. I think that you just arent dividing enough.

Offline trollwarrior1
« Reply #2 - Posted 2014-01-17 17:48:31 »

What code are you using to calculate it. I think that you just arent dividing enough.

1  
2  
3  
4  
5  
long oldTime = System.nanoTime();
//render();
long nowTime = System.nanoTime();

double time = (nowTime - oldTime) / 1000;
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline theagentd

« JGO Bitwise Duke »


Medals: 366
Projects: 2
Exp: 8 years



« Reply #3 - Posted 2014-01-17 17:55:50 »

Nano * 1000 = Microseconds
Micro * 1000 = Milliseconds
Milli * 1000 = Seconds

Take a look at this post on how to measure the time it takes for your GPU do to stuff: http://www.java-gaming.org/topics/normal-for-glclearcolor-and-glclear-to-be-slower-than-the-actual-rendering/31748/msg/295350/view.html#msg295350

Myomyomyo.
Offline Longarmx
« Reply #4 - Posted 2014-01-17 22:14:59 »

Nano * 1000 = Microseconds
Micro * 1000 = Milliseconds
Milli * 1000 = Seconds

@Trollwarrior1 just replace all those * with /  Wink

For what you're trying to do (and I think that you should be measuring in msecs)
1  
2  
3  
double time = (nowTime - oldTime) / 1000000 // In milliseconds
// OR
double time = (nowTime - oldTime) / 1000000000 // In seconds  (would not recommend using this unit)

Offline theagentd

« JGO Bitwise Duke »


Medals: 366
Projects: 2
Exp: 8 years



« Reply #5 - Posted 2014-01-18 01:33:23 »

@Trollwarrior1 just replace all those * with /  Wink
Heh, it was a lazy way of writing "1000 nanoseconds is one microsecond" but I guess it backfired... =P

Myomyomyo.
Offline trollwarrior1
« Reply #6 - Posted 2014-01-18 06:33:52 »

Nano * 1000 = Microseconds
Micro * 1000 = Milliseconds
Milli * 1000 = Seconds

Take a look at this post on how to measure the time it takes for your GPU do to stuff: http://www.java-gaming.org/topics/normal-for-glclearcolor-and-glclear-to-be-slower-than-the-actual-rendering/31748/msg/295350/view.html#msg295350

It still doesn't work, because I cannot put an entry to where the loop starts. It is kinda the same thing. Unless I'm wrong somehow..
Offline Longarmx
« Reply #7 - Posted 2014-01-18 06:46:40 »

Just use the method you were originally using except correct the time conversions. From the numbers you've given, rendering takes .3 milliseconds (300 microseconds) and when you add your update game logic, it bumps it up to 2 milliseconds (2000 microseconds).

Offline UtilityFrog

Senior Newbie


Medals: 1



« Reply #8 - Posted 2014-01-18 10:13:24 »

I'm not sure if this completely solves your needs but LibGDX has a rudimentary built in FPS counter: http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/FPSLogger.html.
Offline trollwarrior1
« Reply #9 - Posted 2014-01-18 10:47:42 »

I want to know how many fps my game can render each second. MAXIMUM number of frames. To render non stop.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline UtilityFrog

Senior Newbie


Medals: 1



« Reply #10 - Posted 2014-01-18 11:31:11 »

Unless I'm misunderstanding you the info you want is provided by Gdx.graphics.getRawDeltaTime(). This gives you the time (in seconds) that the previous frame took to render. To get a useful value you'll need to turn off vsync.
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.

Mr.CodeIt (10 views)
2014-12-27 04:03:04

TheDudeFromCI (13 views)
2014-12-27 02:14:49

Mr.CodeIt (25 views)
2014-12-23 03:34:11

rwatson462 (56 views)
2014-12-15 09:26:44

Mr.CodeIt (46 views)
2014-12-14 19:50:38

BurntPizza (92 views)
2014-12-09 22:41:13

BurntPizza (113 views)
2014-12-08 04:46:31

JscottyBieshaar (85 views)
2014-12-05 12:39:02

SHC (95 views)
2014-12-03 16:27:13

CopyableCougar4 (102 views)
2014-11-29 21:32:03
Resources for WIP games
by kpars
2014-12-18 10:26:14

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
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!