| 39 | overlay_path = 'mplotqueries/overlays/' |
| 40 | |
| 41 | def __init__(self): |
| 42 | LogFileTool.__init__(self, multiple_logfiles=True, stdin_allowed=True) |
| 43 | |
| 44 | self.argparser.description = ("A script to plot various information " |
| 45 | "from logfiles. Clicking on any of the " |
| 46 | "plot points will print the " |
| 47 | "corresponding log line to stdout.") |
| 48 | |
| 49 | # disable some default shortcuts |
| 50 | plt.rcParams['keymap.xscale'] = '' |
| 51 | plt.rcParams['keymap.yscale'] = '' |
| 52 | |
| 53 | # import all plot type classes in plottypes module |
| 54 | self.plot_types = [c[1] for c in inspect.getmembers(plottypes, |
| 55 | inspect.isclass)] |
| 56 | self.plot_types = dict((pt.plot_type_str, |
| 57 | pt) for pt in self.plot_types) |
| 58 | self.plot_instances = [] |
| 59 | self.plot_instance = None |
| 60 | |
| 61 | # main parser arguments |
| 62 | self.argparser.add_argument('--logscale', action='store_true', |
| 63 | help=('plot y-axis in logarithmic scale ' |
| 64 | '(default=off)')) |
| 65 | self.argparser.add_argument('--overlay', action='store', nargs='?', |
| 66 | default=None, const='add', |
| 67 | choices=['add', 'list', 'reset'], |
| 68 | help=("create combinations of several " |
| 69 | "plots. Use '--overlay' to create " |
| 70 | "an overlay (this will not plot " |
| 71 | "anything). The first call without " |
| 72 | "'--overlay' will additionally plot " |
| 73 | "all existing overlays. Use " |
| 74 | "'--overlay reset' to clear all " |
| 75 | "overlays.")) |
| 76 | self.argparser.add_argument('--type', action='store', |
| 77 | default='scatter', |
| 78 | choices=self.plot_types.keys(), |
| 79 | help=("type of plot (default=scatter with " |
| 80 | "--yaxis duration).")) |
| 81 | self.argparser.add_argument('--title', action='store', default=None, |
| 82 | help=("change the title of the plot " |
| 83 | "(default=filename(s))")) |
| 84 | self.argparser.add_argument('--group', |
| 85 | help=("specify value to group on. " |
| 86 | "Possible values depend on type of " |
| 87 | "plot. All basic plot types can " |
| 88 | "group on 'namespace','hostname' 'operation', " |
| 89 | "'thread', 'pattern', range and " |
| 90 | "histogram plots can additionally " |
| 91 | "group on 'log2code'. The group can " |
| 92 | "also be a regular expression.")) |
| 93 | self.argparser.add_argument('--group-limit', metavar='N', type=int, |
| 94 | default=None, |
| 95 | help=("specify an upper limit of the " |
| 96 | "number of groups. Groups are " |
| 97 | "sorted by number of data points. " |
| 98 | "If limit is specified, only the " |