Forum > Third party
CPU & Memory Profiler
ALLIGATOR:
Good afternoon, esteemed community of Pascal lovers!
I am a beginner amateur developer.
I would like to introduce you some two tools I made for performance analysis.
The first one is a memory profiler.
https://github.com/Alligator-1/callstack_memprofiler
With its help you can find not quite optimal places in your project that can be improved, unnecessary or non-obvious memory allocations.
This tool should be cross-platform, but I work on Windows and haven't tested it on Linux, I haven't had time for it yet...
The next tool is a CPU profiler. Unfortunately at the moment it can work only with Windows x64, due to the presence of asm-inserts, porting to Linux x64 is in the plans, but again everything is related to free time.... but I welcome forks, I'm not sure about patches and merge requests yet, but forks are welcome.
Also, it also requires FPC to be patched to make it work.
https://github.com/Alligator-1/cpuprofiler
With this tool as well as with the previous one you can evaluate bottlenecks in the code and maybe find ideas for further optimizations!
Here is a short instruction on how to use CPUProfiler:
* You need to patch FPC and rebuild it
* Then plug profiler_proxy.pas into your project.
* Then somewhere at the beginning of your project call profiler_proxy.profiler_init
* and at the end of the program call profiler_proxy.profiler_reset.
* Set the environment variable profiler=1
* Enable generation of debugging information in the project
* Start compilation of your project via CleanUp & Build
* Run your project, work in it and then terminate it
* The file “datetime.cpuprof” will appear next to the project executable file
* Open it in cpuprofilerviewer, and also in cpuprofilerviewer load the executable itself (to see the symbolic names)If you have any questions - you can ask here on the forum or on github, I will try to answer them )
Keep in mind, I'm just a beginner, so my code may seem suboptimal or confusing to you ) but I'm open to discussion and always looking for more optimal implementations
I hope you find these tools useful! They have already helped me, let them help you too! )
PS: Sorry, I can't figure out how to insert images into a post, but the links have screenshots, if someone could insert them into the posts below that would be great
440bx:
about 40some years ago beginners wrote "hello world" class programs... today they write memory and CPU profilers.
Beginners sure have come a long ways... :)
AlexTP:
> profiler_proxy.profiler_init
This is python naming style. Let's use Pascal naming style: ProfilerInit (unit name can be kept as is).
ALLIGATOR:
--- Quote from: AlexTP on September 10, 2024, 07:29:58 am ---> profiler_proxy.profiler_init
This is python naming style. Let's use Pascal naming style: ProfilerInit (unit name can be kept as is).
--- End quote ---
Thank you! Maybe I'll change it...
--- Quote from: 440bx on September 10, 2024, 07:01:23 am ---about 40some years ago beginners wrote "hello world" class programs... today they write memory and CPU profilers.
Beginners sure have come a long ways... :)
--- End quote ---
Well, at least I'm not a professional programmer, I'm just an amateur who, with the help of a lot of other people, was able to write these two tools. I try to learn the right practices and approaches.
440bx:
--- Quote from: ALLIGATOR on September 10, 2024, 01:22:14 pm ---I try to learn the right practices and approaches.
--- End quote ---
It looks like you're doing very well. :)
Navigation
[0] Message Index
[#] Next page