Re: slow startup on windows

"John Selverian" <[email protected]> Wed, 26 Apr 2023 11:08:04 -0400
Newsgroups gmane.comp.lib.fox-toolkit.user
Organization JAHM Software
Message-ID <[email protected]>
I must be missing something, I open a PowerShell window and run:

./MPDB_win_debug -tracelevel 100

The program starts, then I exit it but I do not see any output,
I'm assuming it would output to the PowerShell window I started
it from.





-----Original Message-----
From: Jeroen van der Zijp <[email protected]> 
Sent: Wednesday, April 26, 2023 1:41 AM
To: John Selverian <[email protected]>
Cc: [email protected]
Subject: Re: [Foxgui-users] slow startup on windows

On Tue, 25 Apr 2023 19:15:21 -0400
"John Selverian" <[email protected]> wrote:

> I think it's a Windows problem. If I haven't started the
program in a 
> while it takes 10 seconds or so before the splash screen shows.
If I 
> start it, exit and restart it right away it only takes a second
or so 
> before the splash screen shows up. The program is 160 MB, I
don't 
> think the size is the problem. My other Fox programs are much
smaller 
> and load almost instantly.
> 
> Probably a dumb question but how do I use FXTRACE()?
> 
> 
> 
> -----Original Message-----
> From: [email protected] <[email protected]>
> Sent: Monday, April 24, 2023 12:11 PM
> Cc: [email protected]
> Subject: Re: [Foxgui-users] slow startup on windows
> 
> On 2023-04-23 16:27, John Selverian wrote:
> > I don't know if anyone else has this same experience.
> > 
> > 
> > 
> > On Windows my fox program takes 10 to 15 seconds to show the
> start
> > window. On linux & OSX it take less than 1 second.  
> 
> I can't say that I have seen this. Perhaps you can use
FXTRACE() to 
> see where it slows down?

FXTRACE() is a macro, works like printf, but uses double (())
instead:

FXTRACE((100,"the value of five = %d\n",5));

Like FXASSERT, FXTRACE is stripped from the source when compiling
code for release (i.e. -DNDEBUG=1).

The number "100" here is the trace "level" or "topic".  The
higher the trace level, the more output you'll see.

Default trace level is 0, so you won't see anything.

When you start an application, you can pass a special flag:


	myapp -tracelevel 100

Print all trace outputs at level 100 or below 0...100.

or:

	myapp -tracetopics 90:100,105

Print trace commands from topics 90,91...100, and a single topic
105.

The macro is active when FOX [or your own program] is compiled
with non-release code, as explained before.

Many things that can happen are logged with FXTRACE, from
high-level things down to lower level things.  The higher the
level, the more you'll see, until its just too much.

Here's an example, showing high-level events at level 100 and
below for the somple "hello" program:

./hello -tracelevel 100

Output:

FXApp::init 1.7.83
FXSettings::parseFile(/crypt/jeroen/.config/fox.rc,0)
FXSettings::parseFile(/crypt/jeroen/.config/FoxTest/FoxTest.rc,0)
FXSettings::parseFile(/crypt/jeroen/.config/FoxTest/Hello.rc,1)
FXApp::openDisplay(:0.0)
X Shared Images  = 1
X Shared Pixmaps = 1
X Render 0.11 available
xrrScreenChange: 89
xfxFixesSelection: 87
XInputExtension maj:131, evt:66, err:129
XInput2 ver:2.4
Device Virtual core pointer id: 2 enabled: 1 attached to: 3 is a
master pointer Device Virtual core keyboard id: 3 enabled: 1
attached to: 2 is a master keyboard Device Virtual core XTEST
pointer id: 4 enabled: 1 attached to: 2 is a slave pointer Device
Virtual core XTEST keyboard id: 5 enabled: 1 attached to: 3 is a
slave keyboard Device Power Button id: 6 enabled: 1 attached to:
3 is a slave keyboard Device Video Bus id: 7 enabled: 1 attached
to: 3 is a slave keyboard Device Power Button id: 8 enabled: 1
attached to: 3 is a slave keyboard Device Sleep Button id: 9
enabled: 1 attached to: 3 is a slave keyboard Device Logitech
G300s Optical Gaming Mouse id: 10 enabled: 1 attached to: 2 is a
slave pointer Device Logitech G300s Optical Gaming Mouse Keyboard
id: 11 enabled: 1 attached to: 3 is a slave keyboard Device HP,
Inc HyperX Alloy Origins Core id: 12 enabled: 1 attached to: 3 is
a slave keyboard Device HP, Inc HyperX Alloy Origins Core Mouse
id: 13 enabled: 1 attached to: 2 is a slave pointer Device HP,
Inc HyperX Alloy Origins Core Keypad id: 14 enabled: 1 attached
to: 3 is a slave keyboard Device HP, Inc HyperX Alloy Origins
Core Consumer Control id: 15 enabled: 1 attached to: 2 is a slave
pointer Device HP WMI hotkeys id: 16 enabled: 1 attached to: 3 is
a slave keyboard Device HP, Inc HyperX Alloy Origins Core
Consumer Control id: 17 enabled: 1 attached to: 3 is a slave
keyboard FXApp::create wantedName=DejaVu Sans [PfEd]
wantedSize=110 wantedWeight=40 wantedSlant=5 wantedSetwidth=0
wantedEncoding=9999 actualName=DejaVu Sans [PfEd] actualSize=110
actualWeight=40 actualSlant=5 actualSetwidth=100
actualEncoding=9999 FXRootWindow::create 0x55d1c77cea20 Start run
FXMainWindow::onConfigure x=1992 y=1066 w=111 h=27
FXMainWindow::onConfigure x=1992 y=1066 w=111 h=27
FXMainWindow::onRestore 0x55d1c7831d60 FXMainWindow::onConfigure
x=1992 y=1066 w=111 h=27 FXMainWindow::onRestore 0x55d1c7831d60
FXMainWindow::onRestore 0x55d1c7831d60 FXMainWindow::onRestore
0x55d1c7831d60 FXMainWindow::onRestore 0x55d1c7831d60
SEL_KEYRELEASE code=ff0d state=0000 stickyMods=0000 text=""
FXMainWindow::onRestore 0x55d1c7831d60
FXMainWindow::onRestore 0x55d1c7831d60
FXApp::exit
FXApp::closeDisplay: closing display.
FXApp::destroy
FXRootWindow::destroy 0x55d1c77cea20
FXSettings::unparseFile(/crypt/jeroen/.config/FoxTest/Hello_21206
2.rc)
End run

-----------------------

You can also set the trace level or topics from environment
variable:

	export FOX_TRACE_TOPICS=0:100

is equivalent to:

	export FOX_TRACE_LEVEL=100

This is recommended, as it'll also dump things happening prior to
the FXApp::init() being called (C++ ctors may run prior to the
start of main()).

Hope this helps; you can use FXTRACE in your own code, and its
painless as its all stripped by pre-processor in release-mode
builds.


		-- JVZ

P.S.

Older versions of FOX did not have capability to just show
individual topics, and only supported levels-based method.