include, exclude processes based on the commandline
[bwmon.git] / runmonitor.py
blob10c3cb81e74bf5694c303132ec40872448517401
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
4 from __future__ import absolute_import
6 import os
7 import sys
8 from optparse import OptionParser
10 sys.path.insert(0, os.path.dirname(__file__) or '.')
12 if __name__ == '__main__':
13 import bwmon
15 parser = OptionParser()
16 parser.add_option('--include', dest='include_filter', type='string', action='append', help='include only processes that match the given regex')
17 parser.add_option('--exclude', dest='exclude_filter', type='string', action='append', help='exclude processes that match the given regex')
19 (options, args) = parser.parse_args()
21 monitor = bwmon.Monitor()
22 monitor.set_filter(options.include_filter, options.exclude_filter)
23 monitor.loop()