Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Window freezing

Status
Not open for further replies.

138006

IS-IT--Management
Dec 30, 2003
101
IN
Hi,
I have a problem -- let me try to explain.

I have 2 compare data of 2 different databases using PERL. Now that is happening correctly. To show a progress bar I am using TK.
Now, when the number of records of the 2 tables (which I want to compare) is huge, then the TK frontend window gets completely blank if I do a "ALT-TAB" for some other window. E.g. I run my comparison tool by clicking on the "Start" Button on my TK window. Then do a "ALT-TAB" and write in a word document. Then again when I do a "ALT-TAB" to see the progress of comparison I find the TK screen to be completely blank. SO, in effect, there is no meaning of the progress bar feature if I can't see the progress!!

If I don't do "ALT-TAB" and keep the TK window active only, then I can see the progress.

Now this might be a memory problem of Windows(I am running on Win2000)--however this problem is not occuring when I run other applications and this is the concern.

Can I do some tweaking in the TK code (the PERL portion for comparison is fine) to make the memory usage more efficient so that it can paint the TK windows after the ALT-TAB??

Please suggest the best practices regarding this. Since memory handling is not there explicitly in TK I don't know what to do.

Please help.
Thanks.
 
Dunno about TK, but in VB DoEvents would be what you're after

might give you a lead

HTH
--Paul

It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ... smack the fecker
 
Hi,
Thanks,
Do you mean DoOneEvent in TK?
Do I need to put it the subroutine that takes long time to run??
Please suggest
 
It might be, basically in VB, DoEvents meant that you didn't tie up the machine ina single thread, because, once a loop you allowed other processes to kick in

Have a look at the documentation on DoOneEvent, it could be what you're after

--Paul

It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ... smack the fecker
 
Hi All,
I have included the DoOneEvent(); within my code and it works. However due to this, for cases where the code was previously running fast enough (withut DoOneEvent) has become quite slow with DoOneEvent.

Is there anyway to circumvent this problem? Is there any value of the parameter of the DoOneEvent function that I need to mention while calling it?

Please suggest.

Regards
 
Hi,
Let me throw some more light on this. My comparison tool is scheduled to run on 2 views. My background program is PERL and I have a TK program to show the Progress Bar and throw appropriate error messages.

Initially when I run the tool with small set of columns,the TK screen used to freeze when I do Alter-Tab to view different windows. This led me to include DoOneEvent() to get the screen activated.

However now, when I run these comparisons with 250--300 columns the PC hangs and I have to terminate the Perl program by hitting "END TASK" from Task Manager. This is very irritating as you understand.

Is there any Memory related tuning that can help me out?

Any suggestions for this ? Please help.
Regards,
 
I'm not sure that the PC is hanging, it could just be IO - Bound, where its waiting on IO to proceed, or CPU bound.

Check the CPU utilization, and also memory utilization on the processes tab of task manager

try putting in some debug print statements to see the level of processing that's gong on

Code:
print LOG localtime()."$numcycles\n";

HTH
--Paul

Nancy Griffith - songstress extraordinaire,
and composer of the snipers anthem "From a distance ...
 
Hi,
I tried with different number of columns for comparison. When I give 150 columns its working but it is hanging ("NOT RESPONDING") for 275 column-pair comparisons.

Any suggestions?

Thanks
 
not responding means that its too busy to respond to the OS, if you put in a few debug print statements, chances are it'll keep writing out even though it'll record not responding on the task bar and in the control panel

--Paul

Nancy Griffith - songstress extraordinaire,
and composer of the snipers anthem "From a distance ...
 
Hi
The database resources are also being alarmingly eaten up. Ne forking or threading feature available in PERL? That may better the situation a bit.

Regards
 
forking and threading may both be available - certainly forking (or something that looks exactly like it) is.

Mike

"Deliver me from the bane of civilised life; teddy bear envy."

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

 
Hi,
Thanks for the help. Now, I am more confused.The tool is running differently in different machines:

In one machine (Win XP) its running ok meaning when u do ALT-TAB then the window gets eanbled after say about 2 secs and I can see the progress bar correctly.

In another machine (Win 2K) its just freezing. The window becomes active only when the job(the database SQL query) is finished . Then it gives "FINISHED" message in the progress bar. But in between, if u do ALT-TAB and then try to bring the TK window, its just not coming at all.

I have yet to check it with different WINXPs and WIN2Ks and come up with a trend.

Is there any issue with the Sustem environments while using TK??

Any advice?

Thanks.
 
To add a little more--

I split my SQL into 2 and still its very heavy. However at the back end the query is running fine even if its slow.

But the entire time the query is running, the frontend TK screen is absolutely frozen.

How can I activate the TK window when there is no new event taking place? I tried DoOneEvent() but its of no use. Should I pass some variables in it or is it something else?

Regards
 
Different versions of windows do have somewhat differently yes, and it's difficult to predict exactly how beforehand.

I've had problems getting this kind of thing to work with w2k - then you change one thing and it works... :-(

Mike

"Deliver me from the bane of civilised life; teddy bear envy."

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

 
Hi,
What is the "One Thing" that you changed and everything in ur world became fine :)
Regards,
 
*grin* I don't remember now exactly - but it was something silly, changed the code around in some loop or something.

You've probably seen it already but there's a FAQ here that deals with this.

faq219-4992

Mike

"Deliver me from the bane of civilised life; teddy bear envy."

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

 
Code:
$kizmet=-1
--Paul

Nancy Griffith - songstress extraordinaire,
and composer of the snipers anthem "From a distance ...
 
Yea Mike,
Seen it and done that way but doesnt help. Instead it makes the actual process slower as well. And once I minimize the TK window and then try to maximize it , it just won't let me do that. After waiting for some time (the time it should take to run the job) I "End Task" TK from Task manager and check the output file which is fine. That means even after the job has finished, the TK window is not getting active.
Thers is a TK function (I guess) called "Focus"--will that help?

Hi Paul,
What does your code do and where will I keep it in the program? Its a variable that u declare , what is the meaning of that? Please elaborate.

Regards

 
Hi,
In addition to that can anyone shed some light on the following concepts:

1) $tk_main --> update apart from updating the progress bar in the loop
2) update idletasks with and without 1)
3) TK :: After , TK :: Refresh etc
4) $b = MainWindow ->New; $a = $b -->ExecuteCommand

Please advise
 
This kind of thing, windows event handling, is just not well documented - and I suppose we shouldn't be surprised that it isn't. Perl/Tk is a cross platform thing - X and MS-Win equally covered. There may well be problems with no fix that can be made common to all of the platforms Perl-Tk will run on.

Your other questions 138006 - that's a lot of, apparently, unrelated questions. Have you thought about starting threads for each question one at a time?

Mike

"Deliver me from the bane of civilised life; teddy bear envy."

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top