Skip to content

Commit

Permalink
Use ps instead of pmap to get memory usage of file2DS process
Browse files Browse the repository at this point in the history
(fixes incorrect pmap memory repoting introduced with kernel version 2.6.32-573.3.1.el6.x86_64)
  • Loading branch information
nikmagini committed Sep 7, 2015
1 parent 20a936d commit 5807275
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -516,13 +516,13 @@ def reset(self):
self.resetCursor()

def getProcessMemory(self, pid):
''' Using pmap to report memory map of a process '''
''' Using ps to report memory usage of a process '''

process = subprocess.Popen('pmap -x %s | tail -1' % pid, shell = True, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
process = subprocess.Popen('ps --no-heading -o vsize -p %s' % pid, shell = True, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
process_tuple = process.communicate()
memory = 0
if process_tuple[1] == '':
memory = int(process_tuple[0].split()[2])
memory = int(process_tuple[0])

self.logger.info('The memory used by the process with pid %s is %s' % (pid, memory) )
return memory
Expand Down

0 comments on commit 5807275

Please sign in to comment.