click here for a list of all existing Templot documentation
Important Privacy Information cookie information pre-print options:    

click image to open Templot Club in a new tab
Templot club top logo
looking for Templot? - (free)



 you are not logged in  - Login | Join


receive all messages by email: info


Recent Topics
Front Page  Search  Image Gallery  Gallery Upload  My Account  Members  Open Source  TemplotMEC  Help  
make a donation  
please click: important information for new members and first-time visitors Templot Companion - User Guide
            messages archive on Yahoo
page trail:  Templot Club > Forums > OpenTemplot Project > CPU issue in OpenTemplot
Templot web site

                                       CPU issue in OpenTemplot
     
 Start new topic   Reply blank   Printer friendly 
  Rate this topic  
AuthorMessage
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
1st message | this message only posted: 11 Jun 2018 17:24
 PM  Reply with quote  Reply blank 
from:
Martin Wynne
West Of The Severn, United Kingdom



view images in gallery
view images as slides

Please do not send requests for help direct to me via email or PM.

Post your questions on the forum where everyone can see them and add helpful replies.
If you have got OpenTemplot running you may have noticed that Houston, we have a problem. :(

When OT is running in the Lazarus debugger, CPU usage is normally 0% (in the Windows task manager) as it should be.

When running outside the debugger, or launched stand-alone, there is significant continuous CPU activity. There is obviously an infinite loop running somewhere.

John McAleely has confirmed that it is not just me. Is it the same for you?

It's a bit of a puzzle why there should be a difference, and it's going to be difficult to track down if it won't do it in the debugger. Why it behaves differently in the debugger is a mystery. It's not happening in Templot2/Delphi5, in the IDE or stand-alone, (you would have noticed).

It needs to be fixed because on laptops it will lead to the fan running and shortened battery life. No-one wants to have to launch Lazarus just to run OT. :?

I think it may be related to the Application.OnIdle event. Templot uses that to do a lot of housekeeping functions, updating the menus, etc. Lazarus has an additional event OnIdleEnd which is not present in Delphi5, and I'm not entirely clear what it would be used for. Maybe something needs to be set there?

 http://lazarus-ccr.sourceforge.net/docs/lcl/forms/tapplication.onidleend.html

Now the great advantage of open-source is that I don't have to fix everything myself. :)

For now I'm going to leave this to someone else while I get on with the next update to Templot2. Anyone? There are some FreePascal profilers you could try.

cheers,

Martin.

__________
message ref: 24947

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
2nd message | this message only posted: 11 Jun 2018 17:51
 PM  Reply with quote  Reply blank 
from:
Rob Manchester
Manchester



view images in gallery
view images as slides
Hi Martin,

When I launch the 'normal version of Templot ( Yellow hat ) CPU usage goes up briefly for ~ 1 second while the program is at the welcome screen and then drops back down while it runs unless you request major re-calculations.

When launching OpenTemplot ( standalone as downloaded ) CPU usage ramps straight up to about 25% across all 4 cores at the welcome screen and stays there while the program is running ( or even if you just leave it on the welcome screen )

Does this help ?
Rob


__________
message ref: 24949

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
3rd message | this message only posted: 11 Jun 2018 19:53
 PM  Reply with quote  Reply blank 
from:
Jim Guthrie
United Kingdom

 

view images in gallery
view images as slides
Coming from another thread at Martin's suggestion, I would tend to look at using something like this

http://wiki.lazarus.freepascal.org/Profiling

...to see what might be causing the CPU usage.

Also is the fault showing on the app compiled with no debug code - I'm assuming that Lazarus offers the choice of compile with or without debug code, just in case there's a funny in the debug code.

I haven't got the app into Lazarus yet so I'm rumaging around in my dodgy memory to re-ignite Delphi knowledge of ten years ago. :)

Jim.
__________
message ref: 24952

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
4th message | this message only posted: 11 Jun 2018 19:57
 PM  Reply with quote  Reply blank 
from:
Martin Wynne
West Of The Severn, United Kingdom



view images in gallery
view images as slides

Please do not send requests for help direct to me via email or PM.

Post your questions on the forum where everyone can see them and add helpful replies.
Thanks Rob.

What happens if you click Run > Run in Lazarus?

I have tried commenting out

 Application.OnIdle:=AppIdle;

which makes no difference. So that is ruled out.

cheers,

Martin.

__________
message ref: 24953

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
5th message | this message only posted: 11 Jun 2018 20:03
 PM  Reply with quote  Reply blank 
from:
Martin Wynne
West Of The Severn, United Kingdom



view images in gallery
view images as slides

Please do not send requests for help direct to me via email or PM.

Post your questions on the forum where everyone can see them and add helpful replies.
Jim Guthrie wrote: Coming from another thread at Martin's suggestion, I would tend to look at using something like this

http://wiki.lazarus.freepascal.org/Profiling

...to see what might be causing the CPU usage.

Also is the fault showing on the app compiled with no debug code - I'm assuming that Lazarus offers the choice of compile with or without debug code, just in case there's a funny in the debug code.
Hi Jim,

I looked at that page earlier. It looked like hours of work, but it may have to come to that.

The options are at Project Options > Debugging. I tried with and without -- no difference. But it's worth double checking.

cheers,

Martin.

__________
message ref: 24954

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
6th message | this message only posted: 11 Jun 2018 20:35
 PM  Reply with quote  Reply blank 
from:
Jim Guthrie
United Kingdom

 

view images in gallery
view images as slides
Martin,

I've just installed OT in lazarus and built and run it and my CPU usage is 4% with OT, Lazarus and Firefox running,  plus whatever is running in the background.  With OT and Lazarus closed,  the CPU usage is still 4%.    Here's a screen grab from Belarc Adviser of my computer details.  I am running Win 10 - it's reporting the original Win 8 installation.



I wonder if it's a processor thing - like Intel versus AMD.

Here's a screen grab with the Gadget Usage Meter on the right


The larger gauge is Usage,  the smaller one, memory

Jim.

__________
message ref: 24955

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
7th message | this message only posted: 11 Jun 2018 20:49
 PM  Reply with quote  Reply blank 
from:
Martin Wynne
West Of The Severn, United Kingdom



view images in gallery
view images as slides

Please do not send requests for help direct to me via email or PM.

Post your questions on the forum where everyone can see them and add helpful replies.
Thanks Jim.

Try running OT without Lazarus running.

Or in Lazarus, Run > Run Without Debugging.

cheers,

Martin.

__________
message ref: 24956

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
8th message | this message only posted: 11 Jun 2018 21:13
 PM  Reply with quote  Reply blank 
from:
Jim Guthrie
United Kingdom

 

view images in gallery
view images as slides
Martin Wynne wrote: Thanks Jim.

Try running OT without Lazarus running.

Or in Lazarus, Run > Run Without Debugging.


Martin,

Yes I was using the "Run" command.  When I use the "Run without Debugging" the CPU usage goers to 31%.   I've double checked with Task manager and my CPU Gadget matches the CPU usage in Task Manager.

What I can't find is my .exe file.  Lazarus tells me it is compiling "opentemplot.exe" but I cannot find it anywhere. :-)

Jim.


__________
message ref: 24958

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
9th message | this message only posted: 11 Jun 2018 21:20
 PM  Reply with quote  Reply blank 
from:
Martin Wynne
West Of The Severn, United Kingdom



view images in gallery
view images as slides

Please do not send requests for help direct to me via email or PM.

Post your questions on the forum where everyone can see them and add helpful replies.
Jim Guthrie wrote:What I can't find is my .exe file.  Lazarus tells me it is compiling "opentemplot.exe" but I cannot find it anywhere. :-)Hi Jim,

In your OT project folder \ lib \ x86_64-win64 \ opentemplot.exe

It's handy to create a desktop shortcut to it. :)

cheers,

Martin.

__________
message ref: 24959

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
10th message | this message only posted: 11 Jun 2018 21:46
 PM  Reply with quote  Reply blank 
from:
Jim Guthrie
United Kingdom

 

view images in gallery
view images as slides
Martin Wynne wrote: Jim Guthrie wrote:What I can't find is my .exe file.  Lazarus tells me it is compiling "opentemplot.exe" but I cannot find it anywhere. :-)Hi Jim,

In your OT project folder lib \ x86_64-win64 \ opentemplot.exe

It's handy to create a desktop shortcut to it. :)
Martin, 

Found it - not used to searching in "lib" folders and Win10 Search facility was no use either. :D

I reset the compiler options to leave out debug information,  which got the .exe size down to 8M and ran the file on its own and the CPU usage was around the 30% mark.

Jim.

__________
message ref: 24962

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
11th message | this message only posted: 11 Jun 2018 22:13
 PM  Reply with quote  Reply blank 
from:
Martin Wynne
West Of The Severn, United Kingdom



view images in gallery
view images as slides

Please do not send requests for help direct to me via email or PM.

Post your questions on the forum where everyone can see them and add helpful replies.
Jim Guthrie wrote:I reset the compiler options to leave out debug information,  which got the .exe size down to 8M and ran the file on its own and the CPU usage was around the 30% mark.Hi Jim,

Yes, same here. It's the absence of debugging activity which causes the problem. Which leaves me scratching my head where to look. What program activity would be cured by running under the debugger? And why doesn't it show up in Delphi?

Installing a profiler may be the only answer.

Martin.

__________
message ref: 24963

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
12th message | this message only posted: 12 Jun 2018 18:49
 PM  Reply with quote  Reply blank 
from:
Paul Boyd
Loughborough, United Kingdom

 

view images in gallery
view images as slides
Hi Martin
Just to confirm that I'm seeing the same thing - around 30% CPU usage running opentemplot.exe standalone whether compiled with debugging info or not (45Mb or 8Mb file sizes), but almost nothing when running in Lazarus in debugging mode.

I'm running on an AMD CPU, but apparently someone else makes CPUs as well!

Cheers,

Paul

__________
message ref: 24977

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
13th message | this message only posted: 13 Jun 2018 15:57
 PM  Reply with quote  Reply blank 
from:
Jim Guthrie
United Kingdom

 

view images in gallery
view images as slides
Martin Wynne wrote: Jim Guthrie wrote:I reset the compiler options to leave out debug information,  which got the .exe size down to 8M and ran the file on its own and the CPU usage was around the 30% mark.Hi Jim,

Yes, same here. It's the absence of debugging activity which causes the problem. Which leaves me scratching my head where to look. What program activity would be cured by running under the debugger? And why doesn't it show up in Delphi?

Installing a profiler may be the only answer.
Martin,

I've had a go at installing profilers but I think I need to learn more about getting packages into Lazarus to get any success. :)

However,  I had a look at what's going on when I start up OT.   When it starts with debugging information on board I get this kind of CPU usage graph



The two peaks in the first four seconds is as the Splash screen appears,  There's then a plateau for about three seconds while the Splash is showing then the usage drops back to zero.   I then clicked through all the following dialog boxes to get to the trackpad which accounts for all the peaks for the next twelve or so seconds.   The high one peaking to 40% comes after I respond to the one or two monitor dialog, responding with single main monitor.    Then the CPU usage stays down in the 3 - 5% area.   This is the total CPU usage on my machine but with nothing else running apart from Lazarus (and whatever background apps are on the go) it's a fairly accurate indicator of OT's usage.  I monitored the actual readings in the Task Manager table and they reflected the graphical output.

I then did the same thing running OT with no debug code included and I got this :-



There's a single peak of 50+ % at the start as the splash screen comes up,  then its a pretty flat plateau thereafter at around 34%   The small peaks after the initial high peak is me clicking through the dialogs to the trackpad.

So it could be something that is being initialised during the splash screen showing that is causing the problem.  The fact that there is a short plateau of around 34% usage in the RunWithDebug version might hint that what's doing that is being terminated in that version but not in the NonDebug version.

I did think of stepping through with debug then thought "wait a minute". :D

I don't know if it might be a help to you.   I've had a look at the initialisation procedures but I'm not making any sense of them at the moment.  I suspect that you might know where to look. :D

Jim.

__________
message ref: 24999
Attached Image (viewed 50 times):

RunWithDebug.jpg
 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
14th message | this message only posted: 13 Jun 2018 17:44
 PM  Reply with quote  Reply blank 
from:
Martin Wynne
West Of The Severn, United Kingdom



view images in gallery
view images as slides

Please do not send requests for help direct to me via email or PM.

Post your questions on the forum where everyone can see them and add helpful replies.
Hi Jim,

Many thanks for taking the trouble to do that.

I've also spent a lot of time trying to pin this down, without getting anywhere. I tried installing a profiler but kept getting error messages during the install.

Whatever it is, it starts immediately with the first screen, as you found. I tried moving as much of the initialisation stuff as I could after the GO button click, but it didn't make any difference.

I have a feeling that this is one of those things which when found will turn out to be blindingly obvious. It's worrying that it doesn't happen in Delphi, because that means it could be a bug in Lazarus itself.

Martin.

__________
message ref: 25000

 
This is topic ID = 3285     Page created at 13:27 (local time)  
You can type a quick reply to this topic here.

Click in the box to begin.


But to reply to an individual message, or to include images, attachments and formatted text, use the reply buttons on each message above.

To start a new topic in this forum, click the Start new topic button below.
To start a new topic in a different forum, click the Forum Jump drop-down list below.

             Start new topic 

 click to jump to a different forum:     Back to top of page

Templot Club > Forums > OpenTemplot Project > CPU issue in OpenTemplot
about Templot Club

list recently active topics Templot Companion - User Guide - A-Z Index Templot Explained for beginners Please click: important information for new members and first-time visitors.
indexing link for search engines

back to top of page


Please read this important note about copyright: Unless stated otherwise, all the files submitted to this web site are copyright and the property of the respective contributor. You are welcome to use them for your own personal non-commercial purposes, and in your messages on this web site. If you want to publish any of this material elsewhere or use it commercially, you must first obtain the owner's permission to do so.

The small print: All material submitted to this web site is the responsibility of the respective contributor. By submitting material to this web site you acknowledge that you accept full responsibility for the material submitted. The owner of this web site is not responsible for any content displayed here other than his own contributions. The owner of this web site may edit, modify or remove any content at any time without giving notice or reason.
Problems with this web site? Contact webmaster@templot.com.   This web site uses cookies: click for information.  
© 2018  

Powered by UltraBB - © 2009 Data 1 Systems