"Fossies" - the Fresh Open Source Software Archive

Member "dstat-0.7.4/plugins/dstat_dstat_mem.py" (17 Jan 2019, 1103 Bytes) of package /linux/privat/dstat-0.7.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "dstat_dstat_mem.py" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 0.7.3_vs_0.7.4.

    1 ### Author: Dag Wieers <dag$wieers,com>
    2 
    3 class dstat_plugin(dstat):
    4     """
    5     Provide memory information related to the dstat process.
    6 
    7     The various values provide information about the memory usage of the
    8     dstat process. This plugin gives you the possibility to follow memory
    9     usage changes of dstat over time. It may help to vizualise the
   10     performance of Dstat and its selection of plugins.
   11     """
   12     def __init__(self):
   13         self.name = 'dstat memory usage'
   14         self.vars = ('virtual', 'resident', 'shared', 'data')
   15         self.type = 'd'
   16         self.open('/proc/%s/statm' % ownpid)
   17 
   18     def extract(self):
   19         l = self.splitline()
   20 #        l = linecache.getline('/proc/%s/schedstat' % self.pid, 1).split()
   21         self.val['virtual'] = int(l[0]) * pagesize / 1024
   22         self.val['resident'] = int(l[1]) * pagesize / 1024
   23         self.val['shared'] = int(l[2]) * pagesize / 1024
   24 #        self.val['text'] = int(l[3]) * pagesize / 1024
   25 #        self.val['library'] = int(l[4]) * pagesize / 1024
   26         self.val['data'] = int(l[5]) * pagesize / 1024
   27 
   28 # vim:ts=4:sw=4:et