AKProfiler

Posted By: krial057

AKProfiler - 02/04/16 21:54

Github link for nicer formated README + Download:
https://github.com/krial057/3dgs-Projects/tree/master/AKProfiler

Copy Pasta from Github README:

AKProfiler

Description
AKProfiler is a tool to profile Lite-c code. Lite-C is mainly used for games developed in the "3d game stuio" game engine. It will log all function calls / waits and return from waits into a file.

Important
This script was written in a short amount of time. MAKE A BACKUP OF YOUR PROJECT before using it, because it was pretty much not tested at all. Normally it shouldn't change any of your files, but you never know...

How to use

Copy the AKProfiler.c file into your project folder and include it anywhere in your project: #include "AKProfiler.c"

Start your project as usual(The engine window will start twice, this is normal!)
The function calls will the be logged in AKP.log on game exit.

If you want the functions of a specific file not to be profiled, yon add the following comment on the first line of the source code: //AKP_DO_NOT_PROFILE

TODO
* Start and stop parsing with buttons/keys
  * Very easy to implement, however need to decide how the user should interact with the plugin + see next point
* Make a graphical user-interface to show statistics of function calls
  * Ideas: generate html file, Google sheet template, draw stats inside the game window
* Show stack trace of functions on engine crash

Restrictions
* Maximal file size to parse is by default a bit less than 100000 characters. You can change that by modifying the following line in "AKProfiler.c": #define AKP_MAX_SCRIPT_SIZE 100000
* on_exit will be overriden

How it works
* AKProfiler.c has a startup function that execute immediatly when the engine starts.
* It immedialty pauses the game.
* It then looks for the main file of your project(First command line parameter).
* Next it parses that file and all files that are included into that file.
* It creates new temporary files for all these files with profiler functions injected at function starts/ends and wait's.
* Then it executes the main temporary file in a new acknex process.
* That process is now your game with profiling functions included in the scripts.
* When the process ends, it deletes all temporary files.
Posted By: Superku

Re: AKProfiler - 02/04/16 22:34

Interesting, thanks for sharing!
Going to check that out soon - hoping that I don't forget.
© 2024 lite-C Forums