Hi,
when using the hotshot profiler, I can see no difference in the
measurement of a function that is busy eating CPU cycles, and
a function that is blocking/waiting on IO (or sleeping)...
For instance I have this output:
3 function calls in 26.931 CPU seconds
Ordered by: internal time, call count
ncalls tottime percall cumtime percall filename:lineno (function)
1 13.465 13.465 13.465 13.465 testprof.py:5(c pu)
1 13.464 13.464 13.464 13.464 testprof.py:9(s leep)
1 0.002 0.002 26.931 26.931 testprof.py:12( main)
0 0.000 0.000 profile:0(profi ler)
My test program (see below) consists of two functions called sequentially:
a cpu() function eating 13+ seconds of CPU cycles when calculating
sha-hashes, and a sleep() function that only has time.sleep(13) in it.
What would be really useful, is that the profiler would show that sleep()
is actually not doing *anything*, while cpu() is doing all the hard work.
I.E.: measure CPU-time, not user-time.
How do I do this? Is this possible? (I'm using Python 2.3.4)
Thanks!!
--Irmen de Jong.
--------------- test program ------------------
import hotshot, hotshot.stats
import time
import sha
def cpu():
for i in range(1000000):
a=sha.sha("abcd efghijklmnopqrs tuvwxyz").hexdi gest()
def sleep():
time.sleep(13)
def main():
print "cpu..."
cpu()
print "sleep..."
sleep()
print "done"
prof = hotshot.Profile ("/tmp/test.prof")
result = prof.runcall(ma in)
prof.close()
print "PROFILE DONE, result=",result ,type(result)
stats = hotshot.stats.l oad("/tmp/test.prof")
stats.strip_dir s()
stats.sort_stat s('time', 'calls')
stats.print_sta ts(20) 0 1587 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: los |
last post by:
Hi,
I'm trying to create a program similar to that of Google's desktop that
will crawl through the hard drive and index files. I have written the
program and as of now I just put the thread to sleep for 1 second after
indexing a couple of files.
I'm wondering if anyone knows of a way that I could make so that the
program will run at full speed only runs after the computer has been
idle for a while. I've looked at the "nice" command...
|
by: buky |
last post by:
How can I find and set an idle time when oracle database releases some
objects (tables, etc.) or opened sessions?
|
by: jdph40 |
last post by:
I am using Access 2002. I downloaded the forms sample database
FrmSmp97.mdb from Microsoft and used the following code in the timer
event of a hidden form in order to close a database if no activity was
detected. I have it set for one minute for testing purposes only.
However, my problem with this code is when the message box pops up and
says "No user activity detected...", you have to actually click the OK
button before the database...
|
by: henk |
last post by:
I have a hard time to get the idle time only from my application. (a
relogin box should appear after eg 1 min, when a user switch to word
and start typing for 10min, the re-login should not appear. It should
appear if my vb appication is active and there was no userinput for
about 1 min.
Found a example at http://www.vbmysql.com/samplecode/idle-time.html
wich works fine, but it's "system wide".
I tried something with me.windowstate but...
|
by: ram.ragu |
last post by:
hi
i have problem to calculate idle time of cpu and if idle time is
more then i have to shut down the system. can anyone tell me the idea
to so that please
| |
by: LG |
last post by:
Hi,
I have recently used the Microsoft that will detect idle time coding on
my Access database and it works fine as long as you do not add any data
or move from one form to another. As soon as you do that, when idling
code kicks, an error message from Microsoft "Microsoft has
encountered a problem and needs to close" comes up.
Do you have any idea how that can be fixed?
Thank you in advance.
|
by: Nettan |
last post by:
Hi everyone
I want to now how long the computer is idle. Is there any easy way to do
this in vb.net 2005. Before (in VB6) I checked if the mousepointer hade been
moved.
Thanks
/Nettan
|
by: Visu |
last post by:
Hi All!
How to find the application idle time in VB.NET windows application?
We can get the windows Idle time
Private Declare Function GetLastInputInfo Lib "user32.dll"
But i want the idle time of my application alone in VB.NET.
|
by: Debabrata Jana |
last post by:
Hi,
I am using Oracle 10g as a database server. I have two schema suppose s1 and s2. Suppose, I login to the s1 schema and as well as s2 schema. These two connection is active in two different session. Now, I want that, If I keep idle for more than 2 minutes in the session for s1 schema, then the session for s1 schema should disconnected from the DB, but the session for s2 schema should remain connected to the DB.
Is that...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |