473,472 Members | 2,163 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

memoru usage of process

I need to know how much memory uses child process (after
subprocess.Popen), so I want function:

get_memory_usage(pid)

I found two ways:

- call "ps" and analyze its output - this is not portable (different
output on Linux, Cygwin and QNX)

- use resource.getrusage - but it works for self/children, not for
single process with given pid

Do you know any ideas how to do it in Python?
Sep 27 '05 #1
3 1428
On Linux, this may work for you

<http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/286222>

/Jean Brouwers

Jacek Poplawski wrote:
I need to know how much memory uses child process (after
subprocess.Popen), so I want function:

get_memory_usage(pid)

I found two ways:

- call "ps" and analyze its output - this is not portable (different
output on Linux, Cygwin and QNX)

- use resource.getrusage - but it works for self/children, not for
single process with given pid

Do you know any ideas how to do it in Python?


Sep 27 '05 #2
MrJean1 wrote:
<http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/286222>


Yes, I have seen it in archive, but I was searching for Python way, and
it's not Python related at all (it is just reading system file), and
won't work on QNX.
Sep 28 '05 #3
What do you mean by 'Python way' and 'not related to Python'?

How is parsing the output of 'ps' different from the method used in
recipe 286222?

/Jean Brouwers

Sep 28 '05 #4

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

Similar topics

3
by: Ian | last post by:
Hi all, I have a problem. I have an application which needs to work with a lot of data, but not all at the same time. It is arranged as a set of objects, each with lots of data that is created...
8
by: rbt | last post by:
Would a Python process consume more memory on a PC with lots of memory? For example, say I have the same Python script running on two WinXP computers that both have Python 2.4.0. One computer has...
3
by: Ian Taite | last post by:
Hello, I'm exploring why one of my C# .NET apps has "high" memory usage, and whether I can reduce the memory usage. I have an app that wakes up and processes text files into a database...
0
by: Dirk Reske | last post by:
Hello, how can I get the memory and cpu usage of a Process? I get the process infos with Process proc = Process.GetProcessByID(...) which value is the Memory usage, I get in the windows Task...
15
by: Dirk Reske | last post by:
Hello, why doesn't this code work correctly? private int GetCpuUsage(Process proc) { DateTime time1,time2; TimeSpan timediff; double cpu1,cpu2,cpudiff;
11
by: Paulo Eduardo | last post by:
Hi, All! We are developing one app for windows 95/98/Me/NT4.0/2000/XP/2003 using Visual C++ 6.0. We need to set the % of CPU Usage to app process. Is there an API to set % of CPU Usage? Can...
7
by: LBT | last post by:
I have a window service written using VB.NET. This window service will scan folders for file and grab the file content to be inserted to SQL Server on file detection. There are altogether 18...
3
by: san | last post by:
we cannot stop the application from increasingly use memory. The CRM Worker process will continually consume memory but not release it back to the system. Please research into how to make the...
3
by: dittytwo | last post by:
Hi all I have been looking around the web and can't seem to find a solution the solution that i have found and manipulated seems to bring back the whole list of currently running process's...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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
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
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.