File: mp_plot

package info (click to toggle)
python-memprof 0.3.6-5.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 252 kB
  • sloc: python: 345; sh: 7; makefile: 4
file content (42 lines) | stat: -rwxr-xr-x 1,453 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python

# Copyright (c) 2013 Jose M. Dana
#
# This file is part of memprof.
#
# memprof is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation (version 3 of the License only).
#
# memprof is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with memprof.  If not, see <http://www.gnu.org/licenses/>.

from memprof.mp_utils import *

import argparse

if __name__ == '__main__':
    parser = argparse.ArgumentParser()

    parser.add_argument('-t','--threshold',type=int, default=default_threshold, action='store', help='threshold (default: %d bytes)' % default_threshold)
    parser.add_argument('logfiles', type=str, default=None, nargs='+', help='the logfiles')

    args, unknown = parser.parse_known_args()

    if not args.logfiles:
        parser.print_help()
        sys.exit(1)

    units, factor = get_units_factor(args.threshold)

    for logfile in args.logfiles:
        print("Processing %s with threshold = %.2f %s" % (logfile, args.threshold / factor, units))
        try:
            gen_plot(logfile, args.threshold)
        except IOError as e:
            print(e)