Recent

Author Topic: LazProfiler (beta)  (Read 38435 times)

Bram71

  • New Member
  • *
  • Posts: 26
Re: LazProfiler (beta)
« Reply #15 on: November 20, 2017, 11:12:01 am »
Ok, be warned! It is a BETA!

Make a backup / spare copy of your "to profile" project sources before trying. I'm glad i did.

Installed and tried with latest trunk. All seams ok when profiling a "small" project. When i try a big project (> 100k lines) i get error 416, list index out of bounds. After that i am unable to reopen and or rebuild the project for normal running / debugging. Als also "Run > Cleanup profiler" does not work on the big project so the code is full of the added profiling enter and exit routines.

Anyone else getting a list index out of bounds?

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: LazProfiler (beta)
« Reply #16 on: November 20, 2017, 11:23:00 am »
Ok, be warned! It is a BETA!

Make a backup / spare copy of your "to profile" project sources before trying. I'm glad i did.

Installed and tried with latest trunk. All seams ok when profiling a "small" project. When i try a big project (> 100k lines) i get error 416, list index out of bounds. After that i am unable to reopen and or rebuild the project for normal running / debugging. Als also "Run > Cleanup profiler" does not work on the big project so the code is full of the added profiling enter and exit routines.

Anyone else getting a list index out of bounds?

Strange! I'm sorry you have had trouble with LazProfiler.
At least "Run > Cleanup profiler" should restore the original sources.
The original sources are renamed to original_filename.lazprofiler_backup at it's original positions.

Is your "big project" available to the public? Then i could test it here.

My biggest test project was about 64k lines.
« Last Edit: November 20, 2017, 11:33:41 am by Pascal »
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Bram71

  • New Member
  • *
  • Posts: 26
Re: LazProfiler (beta)
« Reply #17 on: November 20, 2017, 12:09:18 pm »
Sadly not, it's a commercial application i maintain for a client.

I will try later to find out where exactly the out of bounds is happening. The out of bounds happens when selecting the "Run > profile" before the actual compile cycle starts. The code in the project is nothing fancy, there's just a lot of it spread over multiple include folders.

I have included a small other project that also fails to profile. Its a small (audio) function generator using uos (you might need to download the portaudio dll's and place them in al "lib" subfolder where the compiled executable resides if you actually try to run it). See the function LoadAudio on line 94 of main.pas.

When doing "Run > Profile" this project fails somewhere in uos.pas after some comment. At least thats where the ide opens the file.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: LazProfiler (beta)
« Reply #18 on: November 20, 2017, 12:43:34 pm »
Make sure that the package's "Execute before" entry is blank.
@Pascal, please remove the "Execute before" or change it so it compiles on Linux and other platforms.
This revealed also a usability problem with OpkMan. It does not allow opening the downloaded (broken) package in the IDE. Some of the toolbar buttons operate on selected packages but some don't. For example you would expect the "Open" button to open a selected package but it does not! Clearly there should be 2 visually separated toolbars.

@Pascal, you could also add "$(IDEBuildOptions)" to the compiler "Custom Options" of your package. Then it is built with the same debug flags as the IDE itself. It would allow people to send you backtraces of errors better. A backtrace may be enough to find a bug.
Actually Bram71 already has range check enabled as he got an "index out of bounds" error.
Anybody testing beta or development versions should enable all debug flags and checks.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

balazsszekely

  • Guest
Re: LazProfiler (beta)
« Reply #19 on: November 20, 2017, 01:04:44 pm »
@Juha
Quote
Some of the toolbar buttons operate on selected packages but some don't.
Not selected but checked packages.

Quote
For example you would expect the "Open" button to open a selected package but it does not! Clearly there should be 2 visually separated toolbars.
The "Open" tool button opens the local repository in the file manager.  Opening every checked package make no sense, what if somebody checks 25 package? OPM should open 25 explorer/file manager window?  If you wish to open the broken package in the IDE, you should close OPM and click the error on the message window. OPM is a modal window anyways, you cannot work with the IDE until is opened.

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: LazProfiler (beta)
« Reply #20 on: November 20, 2017, 01:28:54 pm »
@GetMem: I uploaded an updated package. Could you please replace the old one?
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: LazProfiler (beta)
« Reply #21 on: November 20, 2017, 01:31:22 pm »
Make sure that the package's "Execute before" entry is blank.
@Pascal, please remove the "Execute before" or change it so it compiles on Linux and other platforms.

Done.

@Pascal, you could also add "$(IDEBuildOptions)" to the compiler "Custom Options" of your package. Then it is built with the same debug flags as the IDE itself. It would allow people to send you backtraces of errors better. A backtrace may be enough to find a bug.
Actually Bram71 already has range check enabled as he got an "index out of bounds" error.
Anybody testing beta or development versions should enable all debug flags and checks.

Also done!  Package has to be updated by GetMem.
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: LazProfiler (beta)
« Reply #22 on: November 20, 2017, 01:38:03 pm »
Sadly not, it's a commercial application i maintain for a client.

I will try later to find out where exactly the out of bounds is happening. The out of bounds happens when selecting the "Run > profile" before the actual compile cycle starts. The code in the project is nothing fancy, there's just a lot of it spread over multiple include folders.

I have included a small other project that also fails to profile. Its a small (audio) function generator using uos (you might need to download the portaudio dll's and place them in al "lib" subfolder where the compiled executable resides if you actually try to run it). See the function LoadAudio on line 94 of main.pas.

When doing "Run > Profile" this project fails somewhere in uos.pas after some comment. At least thats where the ide opens the file.

The problem was that the runtime unit was added to an inactive define. Solved in 0.1.1.0

0.1.1.0 also keeps the sources instrumented if the build of the instrumented sources fail. Sources can be cleared with "Run > Cleanup Profiler" after studying the error.
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

balazsszekely

  • Guest
Re: LazProfiler (beta)
« Reply #23 on: November 20, 2017, 02:08:13 pm »
Quote
@pascal
@GetMem: I uploaded an updated package. Could you please replace the old one?
Done.

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: LazProfiler (beta)
« Reply #24 on: November 20, 2017, 02:13:52 pm »
Quote
@pascal
@GetMem: I uploaded an updated package. Could you please replace the old one?
Done.

Many thanks!
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Bram71

  • New Member
  • *
  • Posts: 26
Re: LazProfiler (beta)
« Reply #25 on: November 20, 2017, 02:44:12 pm »
Ok, tried again with the new package

The funcgen project now does not run when using "run > profile". I get a profile window wherein all routines are shown with a count of 0 (zero). Also the compiled binary does not run outside the ide. After using the normal "run > run f9" and the project is recompiled binary runs normally in and outside the ide. I also tried the big project again but that one still gives the out of bounds error.

I also noticed on this project (the first time i tried) that the profiler trips over wrong eof characters (visible after the end. in the ide). After removing the old (dos? / D7) eof chars i got to the point where it gives the out of bounds error.

This project also builds and runs normally with F9 with and with out debugging.

I test on a Ubuntu 16.04 xfce vm and normally build my projects for Windows & Linux 32/64 x86 and arm V7m. The test laz/fpc is build with FPCupDeluxe trunk updated yesterday.

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: LazProfiler (beta)
« Reply #26 on: November 20, 2017, 02:51:16 pm »
I also noticed on this project (the first time i tried) that the profiler trips over wrong eof characters (visible after the end. in the ide). After removing the old (dos? / D7) eof chars i got to the point where it gives the out of bounds error.

Do you get the out of bounds error while instrumenting the sources or when the instrumented project runs?
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Bram71

  • New Member
  • *
  • Posts: 26
Re: LazProfiler (beta)
« Reply #27 on: November 20, 2017, 03:05:35 pm »
On the big project i get the error when instrumenting before anything in the messages window in the ide appears.

After that i am no longer able to open the project without the out of bounds error. I also have to restore the source from my backup because in a lot of files the LazProfilerRunTime is still in the uses sections. Checked again and there are no backup copies in the source folders.

After restore from my backup i can just build and run the project again. I checked if there where any file acces and or rights issues on the folders and that is not the case. Also all file names are in 8.3 format since its a project that has been a work in progress since Delphi 1...

On the little funcgen project i don't get any errors. It simply does not show its main form and appears to end without an exception after witch the profile window is shown with all the zero counts.

Bram71

  • New Member
  • *
  • Posts: 26
Re: LazProfiler (beta)
« Reply #28 on: November 20, 2017, 03:20:06 pm »
I just created a small new test project with a single button.onclick handler adding some text to a memo and this project runs and profiles as expected.

So we can deduct that my installed lazarus, fpc and profiler are working and the cause of the problems i encounter are project / project settings specific.

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: LazProfiler (beta)
« Reply #29 on: November 20, 2017, 03:23:16 pm »
On the big project i get the error when instrumenting before anything in the messages window in the ide appears.

After that i am no longer able to open the project without the out of bounds error. I also have to restore the source from my backup because in a lot of files the LazProfilerRunTime is still in the uses sections. Checked again and there are no backup copies in the source folders.

After restore from my backup i can just build and run the project again. I checked if there where any file acces and or rights issues on the folders and that is not the case. Also all file names are in 8.3 format since its a project that has been a work in progress since Delphi 1...

Okay, so there is a problem renaming the original files to *.lazprofiler_backup. That's why there are no backup copies.
I should check that before writing the instrumented source file!

project_executable.lazprofiler_setting is a csv file with all instrumented procedures/functions if it's available it will be loaded on opening a project.
Could you attach this file so i can test why it causes the out of bounds error on loading?
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

 

TinyPortal © 2005-2018