

Jud
Members-
Content Count
141 -
Joined
-
Last visited
Everything posted by Jud
-
I have 20 TMemos, named memo1 ... memo20. I have an integer which indicates which memo is to be written to. Is there a direct way to write to the desired memo, as opposed to a large, ugly case statement?
-
Thanks, it works well. You guys are the greatest!
-
I have a multitasking program that has been running for weeks, but now I'm having problems adding WaitForAll to do some things when all tasks have been finished. First, some minor problems when I add WaitForAll: the main form is no longer responsive - I can't drag it or close it. Mainly though, are problems with updating the screen. Each task has a memo that it updates occasionally. Also, there are labels for the elapsed time and estimated remaining time. These work without WaitForAll but when WaitForAll is added, the program locks up if it tries to write to a memo or change the caption of a label. I know that these aren't thread safe, but they work if WaitForAll isn't in the program. Is there an easy way to get these to work?
-
Thanks. I don't think that it must be called in the main thread.
-
So do I need to put all of the stuff where the tasks are called and WaitForAll into a thread, or just WaitForAll? I've tried the memo updates with and without TThread.Synchronize.
-
I write some programs in Delphi that make heavy use of the CPU for a long time. I used to use Windows 7, 8, and 10 on Sandy Bridge, Ivy Bridge, and Haswell i7 CPUs, with four hyperthreaded cores. For multitasking, I could get 98% CPU usage. Now I'm using Windows 11 on 12th-14th generation i7s, with eight hyperthreaded P-cores. But I cannot get more than about 40% CPU usage with 16 threads running. I look at Task Manager and Process Monitor, and see the under-utilization of the CPU. I have the power setting set for high performance. What caused this loss in performance - Windows or the new CPUs? And is there a way to utilize most of the CPU?
-
Update I've spent a good deal of time experimenting with this. There are two points: 1. The people that said to look at performance instead of CPU utilization were right. 2. Modern CPUs are different from older ones. I've done optimizations for multitasking for more than 10 years. Years ago I did it with Sandy Bridge, Ivy Bridge, and Haswell i7s (32GB of DDR3) and Sandy Bridge and Ivy Bridge Xeons (128GB of DDR3) - all with four hyperthreaded cores. On those, generally the higher the CPU utilization, the more throughput. The exception is when memory bandwidth starts to be the limit - then it is usually better to be running seven tasks instead of eight (in my tests). But now I'm doing it on 12th- and 14th-generation i7s (64GB and 128HB of DDR5) and Kaby Lake Xeons (512GB of DDR4). The Kaby Lake Xeon has four hyperthreaded cores and it behaves like the aformentioned CPUs. The new i7s with eight hyperthreaded cores behave differently. When running 16 threads, the CPU was utilized under 50%. I tried running more threads - that utilized more of the CPU, percentage wise, but didn't help performance. I tried 20 threads, and that had the same performance as 16 threads. I tried 24 threads, and that had 3% more performance than 16. I tried 28 threads and that had 3% less performance than 16 threads. These all utilized a higher percentage of the CPU. So you really aren't gaining much, if anything, by running more than 16 threads, in my test, and you are using more electricity. In fact, 15 threads performs better than 16.
-
Well, I used to be able to get to 100% usage, now I can't get 50%.
-
I was allowing it to use all cores. But it doesn't seem to be putting my program on E-cores To be sure, I set the affinity to use only P-cores. Neither way gives the performance I expected.
-
No, it is a desktop.
-
I installed this patch yesterday, and I'm having a lot of problems. Is anyone else having them? Problems include failing to terminate a program in the IDE, access violations, Find Declaration quits working, etc.
-
Well, I need to download it again and try the installation again.
-
It didn't show up on Getit (I noticed it on the Welcome page yesterday) - I did a complete install. I was having so many problems that I couldn't get work done, so I went back to the original 12.2. But I had many problems getting the patched version installed. It locked up several times, and I had to reboot. ------------------ Also, will they ever be able to transfer your settings to a new installation? I had to set all of the options twice yesterday.
-
I want to show a confirmation question before closing the main form by clicking on the "x" in the upper right corner. The following is based on Delphi help, the example given in a link in tform.OnCloseQuery help. It used to work in another program but it doesn't work in my current program. I put "procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);" in the form's class. Then I have this, based on the example: procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin if MessageDlg( 'Do you want to exit the program?', mtConfirmation, [mbYes, mbCancel], 0) = mrCancel then CanClose := false; end; The program starts and then I click a button to start some tasks. If I click on the "x" before the tasks are started, it closes immediately. If I do it after the tasks have started, it closes immediately if it is running from the EXE. If it is running from the IDE, it gives an access violation. What do I need to do to make it behave as intended (i.e. confirm before closing the form.)
-
I added it manually because before when I clicked on "OnCloseQuery" in the form's inspector, it would not let me add it there, like the form OI usually does. But now it does, and is working. (I don't remember the error message I got when I tried c;licking on the event OnCloseQuery before.) Thanks for the replies!
-
If I remember correctly, VCL ProgressBars used to show the percentage, in numerals. I'm trying to add one to a Delphi 12.1 project, and it isn't showing the percentage. I looked at the properties but I didn't see any that seemed like it would turn on the display of the percentage. Is there a way to show percentage on a TProgressBar in Delphi 12.1 VCL?
-
TGuage might have been it.
-
Thanks, just my faulty memory from some years ago. I just stuck a label above it - that is what I must have done way back when.
-
I thought it used to show the percentage. It would probably easiest to just put a TLabel above it to tell the percentage.
-
It used to be that if I started a second instance of the Delphi IDE, it would warn me and ask if I wanted to start another instance. Now it doesn't ask - I sometimes have 2, 3, or 4 instances running inadvertently, which I want to avoid. I got a new computer with Windows 11 instead of 10, and I've upgraded Delphi. Is there a setting in Delphi that warns you about starting a second instance? Is it a Windows setting? (I know how to keep a second instance of my program from running.)
-
OK, that IS what I used to use. It gives the warning, and then you seem to have no choice but to open the second instance, but then you know, and can close the new one. Thanks!