473,508 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Current execution frame of another thread?

I would like to try a sampling approach to profiling. My thought is to have
a profiling thread that samples the execution frame of all the other
started threads. I don't see any path from the threads returned by
threading.enumerate() to their current frames. Am I missing something?

Thx,

Skip

Nov 22 '05 #1
4 2257
sk**@pobox.com wrote:
I would like to try a sampling approach to profiling. My thought is to have
a profiling thread that samples the execution frame of all the other
started threads. I don't see any path from the threads returned by
threading.enumerate() to their current frames. Am I missing something?


I doubt that works. As python uses the OS underlying threading model, it
doesnn't know about the internal management structures - and even it
knew, these had to be carefully designed for that exact purposes of
yours, as the stack frame can only be safely inspected by the thread
_running_ in it.

An external thread could be interrupted at all times while traversing
other threads management structures, and then find a corrupted memory
location when it is re-scheduled.

Maybe one could write a threading model that allwos for hooks in the
scheduler (which has all the time in the world for such stuff) - but I'm
not aware that that's possible under e.g. pthreads, so there is unlikely
a python-way to do so.

Regards,

Diez
Nov 22 '05 #2
sk**@pobox.com wrote:
I would like to try a sampling approach to profiling. My thought is to have
a profiling thread that samples the execution frame of all the other
started threads. I don't see any path from the threads returned by
threading.enumerate() to their current frames. Am I missing something?


I doubt that works. As python uses the OS underlying threading model, it
doesnn't know about the internal management structures - and even it
knew, these had to be carefully designed for that exact purposes of
yours, as the stack frame can only be safely inspected by the thread
_running_ in it.

An external thread could be interrupted at all times while traversing
other threads management structures, and then find a corrupted memory
location when it is re-scheduled.

Maybe one could write a threading model that allwos for hooks in the
scheduler (which has all the time in the world for such stuff) - but I'm
not aware that that's possible under e.g. pthreads, so there is unlikely
a python-way to do so.

Regards,

Diez
Nov 22 '05 #3
sk**@pobox.com wrote:
I would like to try a sampling approach to profiling. My thought is to have
a profiling thread that samples the execution frame of all the other
started threads. I don't see any path from the threads returned by
threading.enumerate() to their current frames. Am I missing something?

Just another thought: Maybe stackless python can be of use here - as it
epxlicits the stack frame, you might be able to inspect it. But I
_think_ basically the same limitations apply as in my other post - you'd
need to be able to stop a thread, scan its frame, and reschedule it.

Diez
Nov 22 '05 #4
sk**@pobox.com wrote:
I would like to try a sampling approach to profiling. My thought is to have
a profiling thread that samples the execution frame of all the other
started threads. I don't see any path from the threads returned by
threading.enumerate() to their current frames. Am I missing something?

Just another thought: Maybe stackless python can be of use here - as it
epxlicits the stack frame, you might be able to inspect it. But I
_think_ basically the same limitations apply as in my other post - you'd
need to be able to stop a thread, scan its frame, and reschedule it.

Diez
Nov 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1299
by: Don | last post by:
Given a page with a "header" and "main" frame, is there some way from the "header" frame to initiate re-execution of the JavaScrip/HTML code in the "main" frame? I don't want to have to reload...
3
2870
by: Peter Rilling | last post by:
How do I put to sleep a thread other than the current one? I want to put another thread to sleep to the specified number of milliseconds but the Sleep method seems to only work for the current...
4
3841
by: Vlad | last post by:
I have implemented an asyncrhonous execution of a method using the delegate's BeginInvoke() I am trying to spin multiple worker threads in a thread pool. Here is the code: TestProcess process =...
1
1060
by: Stropher | last post by:
Hi! I have a db-query which takes too long to complete. In this process, it will not be bad notifying the user that something is being done so as to exercise some patience. How can I realise...
10
6842
by: greenb | last post by:
Our asp.net web app uses a .NET component (DLL) in the bin directory to call several stored procedures back to back to perform updates. They don't return any data. Sometimes the total execution...
0
279
by: skip | last post by:
I would like to try a sampling approach to profiling. My thought is to have a profiling thread that samples the execution frame of all the other started threads. I don't see any path from the...
1
1027
by: Selva Chinnasamy | last post by:
I have read large amount of data from Ms-Access database to build BinaryArray. I like to know how can I stop the current execution after it is statrted. Functions build the Binary array is not...
42
3812
by: smerf | last post by:
Using javascript, is there a way to trap an external page inside a frame? I've seen scripts to break out of frames, but nothing to keep a page trapped in a frame.
10
2422
by: Michael B. Trausch | last post by:
Alright, I seem to be at a loss for what I am looking for, and I am not even really all that sure if it is possible or not. I found the 'pdb' debugger, but I was wondering if there was something...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7123
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7324
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7042
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7495
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3193
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1556
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.