473,573 Members | 2,869 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.enume rate() to their current frames. Am I missing something?

Thx,

Skip

Nov 22 '05 #1
4 2259
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.enume rate() 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.enume rate() 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.enume rate() 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.enume rate() 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
1313
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 "main". Thanks in advance. Don ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1...
3
2875
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 thread while the Suspend method has no parameters to specify a duration.
4
3854
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 = new TestProcess(TestProcess); process.BeginInvoke(args,null,null); private void TestProcess(args) {
1
1064
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 this? With the help of thread, but how? Thanks in advance... Stropher
10
6854
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 time can take 2-3 minutes, but even though I have set the executionTimeout in web.config to a high number of seconds (2400), the request will still...
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 threads returned by threading.enumerate() to their current frames. Am I missing something? Thx, Skip
1
1033
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 on a different thread. Any help is greatly appreciated. Selva
42
3844
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
2427
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 that would trace or log the order of line execution for a multi-module Python program. I am having a little bit of a problem tracking down a problem...
0
7705
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8205
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6424
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5601
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5294
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3734
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3739
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2223
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 we have to send another system
0
1044
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.