#### Topic: Project Profiler issue

Jeff,

I'm have difficulty accessing the Project Profiler using SF 2.31 build 2290.  Using a single module program, the Profiler works just fine.  But when I try Profiling a large 30 module program that uses AppGraphics, no profile is created. I did check the profier option in the project menu and  I've not tried profiling a large multi-module program without using AppGraphics.

I have not explored this issue further, but wondered whether there is a size limitation for the Profiler, or is compatable with AppGraphics.

I look forward to any suggestions that may help get the profiler working.

Thanks as always,

Frank

#### Re: Project Profiler issue

Frank,

There is no size limitation on the profiler (it is just GNU gprof under the hood), and AppGraphics shouldn't affect it.  However, AppGraphics does introduce threads, which may skew profiler results.  I'll see if I can replicate the issue, though.

Is your project a 32- or 64-bit project?  Which version of Windows are you on?

Jeff Armstrong
Approximatrix, LLC

#### Re: Project Profiler issue

Jeff,

I'm running Windows 7 (64-bit)

Frank

#### Re: Project Profiler issue

Frank,

The project is also 64-bit?

When you enabled profiling, did you first clean your project?  Everything needs to be recompiled to ensure that profiling works, and I don't believe that Simply Fortran actually forces this to occur when that flag is changed.  I'm just trying to eliminate some small issues.

Also, you mentioned that "...no profile is created."  What exactly do you mean?  Do the profile results come back blank?

Jeff Armstrong
Approximatrix, LLC

#### Re: Project Profiler issue

Jeff,

Profiler problem solved.

Project steps taken:
-Build
-Clean

-Project
-options
-General
-Exec
-64 Bit
-Gui
-code generation
-optim - common
-Enable Profiling
-CPU - generic
-compile strictly selection
-fortran
-'all' unchecked
-all static
-compiler
-fortran compiler - empty
-C compiler - empty
-linker: -lappgraphics -lgdi32 -lcomdlg32 -lcomctl32 -luuid -loleaut32 -lole32

-Build
-Profile --> compile and run program (runs okay)

-Profile (selected again after program runs and completed)
( Profiler Error - Profiling data does not yet exist... )

However, the gmon.out file was created in the program project sub-folder where the program accesses a data file.
The gmon.out file is not located in the project folder (.../fortran/myprog but in .../fortran/myprog/data ).

But when the gmon.out file is copied back to the project folder and the Profile Project option is selected, then the profiler does read the gmon.out file and results are displayed properly.

Solution: The Profiler file gmon.out must be located in or copied to the main project file where the program is compiled and run even if the program reads a data file from another folder.

Frank

#### Re: Project Profiler issue

Frank

Ah, I see what's happening.  The gmon.out file would be created in the working directory when the program runs.  By default, the working directory is also the project directory.  However, if you change the working directory, the profiler is still looking for gmon.out in the project directory.

Interesting bug!  I'll see that it's fixed!

Jeff Armstrong
Approximatrix, LLC

#### Re: Project Profiler issue

Frank,

Is your program actually changing the current directory itself?  Looking at Simply Fortran, it already does account for a different working directory when trying to locate and load gmon.out.  Specifically, I'm wondering if your code calls

CALL CHDIR("path\to\data")

while running.  Simply Fortran really wouldn't know where to locate the profiler data in that case.

Jeff Armstrong
Approximatrix, LLC

#### Re: Project Profiler issue

Jeff,

Regarding the question of whether my program is changing the current directory itself, I would have to say yes, but...
It does NOTchange the directory using a CALL CHDIR() statement, but it does open a file for data entry using AppGraphics Openfile statement in a different directory from the programs current directory thereby changing the directory.

For example,

using AppGraphics open menu it could open a data file in a sub-directory of the programs directory, or a completely different directory from the programs current directory.

(.../fortran/myprog opens a data file in .../fortran/myprog/data )
or
(.../fortran/myprog opens a data file in .../fortran/notmyprog/data ).

I hope my explanation was helpful,

Frank

#### Re: Project Profiler issue

Frank,

The Windows file dialogs can change the working directory, which is what's occurring in your case.  We don't really have a good method of detecting this, though, when trying to open the profiler data.  I'll try to think of a solution, but, for now, you'll need to copy gmon.out back to your project directory to generate profile results.

Jeff Armstrong
Approximatrix, LLC