CPU max. utilisation

This forum is for eXpress++ general support.
Post Reply
Message
Author
Victorio
Posts: 620
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

CPU max. utilisation

#1 Post by Victorio »

Hi,
I am using "multiprocesor" processing in my app, this mean, I run main app and this run via runshell several other exe apps , number by number CPU on PC.
Every app use 100% CPU performance, and because this PC (virtual server) is hard managing.
How can I down using CPU performance to less than 100% ? For example 95% , and 5% is enough to some managing.
When I put sleep to process, this down speed processing .

Is some parameter to set max used performance to each exe ? Or in Xbase how can I test how performance app runs and when run more as 95 put sleep()

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: CPU max. utilisation

#2 Post by rdonnay »

You should not be seeing 100% utilization in any of your Xbase++ apps, unless you have DO.WHILE or FOR.NEXT loops running constantly with no Sleep() in the loops.
The eXpress train is coming - and it has more cars.

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: CPU max. utilisation

#3 Post by Auge_Ohr »

hi,

what are your external App doing when using 100% CPU :?:

have a look in Taskmanager -> Tab Detail -> Popup Menu : "Priority"
depend on OS Xbase++ Apps used "higher than normal" to speed-up Single-Core App.
you can reduce Priority but you need to set it manual for each App when use RunShell()

---

Runshell() default have a Console Window and Priority is set in Source

Code: Select all

      if( ! CreateProcess( 0, (TCHAR*)HMG_parc( 1 ), 0, 0, FALSE,
                           CREATE_NEW_CONSOLE | NORMAL_PRIORITY_CLASS,
                           0, 0, &StartupInfo, &ProcessInfo ) )
                hb_retnl( -1 );
GUI Apps can use a Manifest where you can change Priority.

BUT as Roger say : your Code should not "stay" at 100% hole Time :naughty:

---

modern CPU have "All-Core" and "Single-Core" Turbo Boost but "Single-Core" Turbo-Boost can not run hole Time.
so it will "fall back" to "All-Core-Turbo-Boost and stay at that Speed :!: even when App can use Single Core only.

so if you use a Timer Thread before Time exceed with SLEEP(0) than it will start again with "Single-Core" Turbo Boost.

---
instead of Runshell i recommend to use Class TRunProcess from Pablo
TRunProcess.zip
need ot4xb
(3.95 KiB) Downloaded 495 times
Return Value is hInstanze of running Procress

in your "Master"-App run a Thread for each called App and use hInstanze to "control" it
greetings by OHR
Jimmy

Victorio
Posts: 620
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: CPU max. utilisation

#4 Post by Victorio »

Hi,
Thanks for advices, I must examine Trunprocess.
So I run main program, and from it I call several "exe" modules, every module processing some text operations, decrypting data, converting from OEM to ANSI and back, and full text search with many logical operations, and work with large number of text files (about 150GB )
All runing on virtulal server with 12 cores, and every core is mostly on 100%, or near 100%.
Note : at one moment running 12 modules every on own core CPU

One batch run several hours.
I cannot set priority because exe called by runshell every time, main application run "exe", and this "exe" module processing, when finish, write data to SQL database, and stop. Main program read this database, when see process finish, start other "exe" module again with runshell and so on many times , about 5000 x for half hour.
I know this is not ideal, but it is necessary divide process to 12 paralell processes, to down time for processing.

Ok, I can try trunprocess, and will see what help.

THX

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: CPU max. utilisation

#5 Post by Eugene Lutsenko »

It's all very cool! Have you tried using GPUs for calculations? This is even much cooler

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: CPU max. utilisation

#6 Post by Auge_Ohr »

hi,
Eugene Lutsenko wrote: Wed Oct 28, 2020 11:36 am It's all very cool! Have you tried using GPUs for calculations? This is even much cooler
do you have a working Interface for Xbase++ :?:

@ Eugene and Victorio : you both work with big data which is out of Xbase++ Limit.

imagine what if we have "other" Super Class instead of XbParts with all Method, Property, Events and Notify Message
you still can use Xbase++ Dialect which will be "transpiled" to C-Code which runs much faster.
greetings by OHR
Jimmy

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: CPU max. utilisation

#7 Post by Eugene Lutsenko »

As far as I know C# allows programming on the GPU with convenience

Victorio
Posts: 620
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: CPU max. utilisation

#8 Post by Victorio »

Eugene, I know GPU will help, but I mean this need powerfull graphics card, and I do not know, if it is possible on Windows 2012 virtual server.
Other I do not know how realise it, way back You wrote aboit it .

Jimmy
"imagine what if we have "other" Super Class instead of XbParts with all Method, Property, Events and Notify Message
you still can use Xbase++ Dialect which will be "transpiled" to C-Code which runs much faster."
You know how it can realise ?
I know C-code is very quick, original version my application created in 1993 year I had in CA Clipper and used same system with external EXE modules, and this modules was programmed in C++ (Borland C++) and was very qick. When reprogramming to Xbase++ it was very hard to get some speed , Tom, You, and Roger help me very for optimalisation code.
But still stay problem with CPU utilisation also in C app can be great risk to "halt" computer.

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: CPU max. utilisation

#9 Post by Auge_Ohr »

Victorio wrote: Thu Oct 29, 2020 1:52 am You know how it can realise ?
YES ...
i´m on the Way to made a Xbase++ "Clone" with QT LIB from Nokia. https://www.qt.io/

have a Look at QT Tutorial and look at OOP Syntax. i guess you can "read" and "understand" it.
http://www.elektrosoft.it/tutorials/hbqt/hbqt.asp
so it need "just" a Wrapper use use Xbase++ Syntax.
As far as I know C# allows programming on the GPU with convenience
DoNet need "Framework" so it is only for Windows OS.
greetings by OHR
Jimmy

Post Reply