473,785 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getrusage

When I call resource.getrus age on Linux, I don't get any memory stats:

Python 2.2.2 (#1, Jan 30 2003, 21:26:22)
[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2
Type "help", "copyright" , "credits" or "license" for more information.
from resource import getrusage,RUSAG E_SELF
print getrusage(RUSAG E_SELF) (0.019531, 0.0078119999999 999995, 0, 0, 0, 0, 178, 387, 0, 0, 0, 0, 0, 0, 0, 0)


On AIX, I get the correct numbers.

What is the goal? I need to find a memory leak in an extension module.
For starters, I was going to find extension method calls that produce
unexpected memory use (and I found some on AIX - but our 12 year old AIX
system is *so* slow). Suggestions are welcome.
Jul 18 '05 #1
2 3842
Stuart D. Gathman wrote:
When I call resource.getrus age on Linux, I don't get any memory stats:

Python 2.2.2 (#1, Jan 30 2003, 21:26:22)
[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2
Type "help", "copyright" , "credits" or "license" for more information.
from resource import getrusage,RUSAG E_SELF
print getrusage(RUSAG E_SELF)

(0.019531, 0.0078119999999 999995, 0, 0, 0, 0, 178, 387, 0, 0, 0, 0, 0, 0, 0, 0)

On AIX, I get the correct numbers.


On FreeBSD, you get correct numbers as well. The Linux kernel, however,
doesn't implement the RUSAGE field, even though it could easily be done
(I once had the same question as you, and did this research then).
What is the goal? I need to find a memory leak in an extension module.


Try compiling a debug version of Python with the option --with-debug and
you can debug refcount problems much better.

-- Gerhard

Jul 18 '05 #2
On Wed, 10 Sep 2003 19:49:36 -0400, Gerhard Häring wrote:
On FreeBSD, you get correct numbers as well. The Linux kernel, however,
doesn't implement the RUSAGE field, even though it could easily be done
(I once had the same question as you, and did this research then).
What is the goal? I need to find a memory leak in an extension module.


Try compiling a debug version of Python with the option --with-debug and
you can debug refcount problems much better.


The leak turned out to be in the C library wrapped by the extension
module. I debugged the C library with http://dmalloc.com

Very nice package.

--
Stuart D. Gathman <st****@bmsi.co m>
Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flamis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.
Jul 18 '05 #3

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

Similar topics

0
1820
by: Matthias Oberlaender | last post by:
My problem is that cpu times returned by getrusage seem to be rounded to 10 ms units (so also does time.clock). I never noticed such a low resolution in previous versions. Since I have not found similar reports on the web, it probably is not a general bug in (rather outdated) version 2.2.1. Any idea what could be wrong with this peculiar installation? Thanks a lot!
2
1887
by: Frank | last post by:
Hi, I got a test script with thread. Pretty much the basic stuff. Each threat runs the same subroutine. At the beginning and end in the subroutine I call getrusage to get the usage. But I can get only the information for the whole processes and not particular to 1 thread. Is it possible to get the rusage per thread? (the threads are pthreads, so there should not be any specific OS issues) Thanks in advanced,
4
9882
by: JackyMove | last post by:
Dear all, I would like to get the time on how long to run a short segment of my c program in usec under Windows platform using dev-c++. Is there any method or function call to get it other than using clock()? Thank you very much. Regards, Jacky
40
5724
by: aku | last post by:
I'm looking for the absolute fastest way to count the nr of bits that are set to "1" in a string. Presumably I then first need the fastest way to do this in a byte. I think this is it, but welcome any improvements: i = 0; if (g && 1) i++; if (g && 2) i++;
7
4808
by: sathyashrayan | last post by:
Group, Following function will check weather a bit is set in the given variouble x. int bit_count(long x) { int n = 0; /* ** The loop will execute once for each bit of x set,
35
5513
by: Alex Martelli | last post by:
Having fixed a memory leak (not the leak of a Python reference, some other stuff I wasn't properly freeing in certain cases) in a C-coded extension I maintain, I need a way to test that the leak is indeed fixed. Being in a hurry, I originally used a q&d hack...: if sys.platform in ('linux2', 'darwin'): def _memsize(): """ this function tries to return a measurement of how much memory this process is consuming, in some arbitrary unit...
3
1971
by: babis85 | last post by:
Hello guys, i have this part of code and i want to compute the time of processes A, B and C : /* process A */ pid_t pid1, pid2, pid; struct rusage ru1, ru2; pid1 = fork(); if (pid != 0) {/* parent process */ pid2 = fork();
14
3286
by: Henning Hasemann | last post by:
Hi all, sounds trivial (I hope it is): Im searching for a way to get a time-value thats more exact than just seconds (i.e. I need milli- or microseconds or something similar, just at least as good as 1/100 second should suffice) and it should work with gcc (really g++) under linux and the MingW compliant under windows xp. I found an easy and universal sounding way in gmtime & co, but they dont seem to be available under my windows mingw...
74
4611
by: aruna.mysore | last post by:
Hi all, I have a simple definitioin in a C file something like this. main() { char a; ....... int k; }
0
10350
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10157
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10097
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,...
0
9957
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 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...
1
7505
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5518
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
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
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.