t = Test3(traces, args.pid)
    elif args.test == 4:
        t = Test4(traces, args.pid)
    elif args.test == 5:
        t = Test5(traces, args.pid)
    elif args.test == 6:
        t = Test6(traces, args.pid)
    elif args.test == 7:
        t = Test7(traces, args.pid)
    elif args.test == 8:
        t = Test8(traces, args.pid)
    elif args.test == 9:
        t = Test9(traces, args.pid)
    elif args.test == 10:
        # stress test, nothing reliable to check
        ret = 0
    elif args.test == 11:
        # stress test, nothing reliable to check
        ret = 0
    else:
        print("Invalid test case")
        sys.exit(1)

    if t is not None:
        ret = t.parse()

    for h in handle.values():
        traces.remove_trace(h)

    sys.exit(ret)
            print('Invalid MongoDB address format: ', args.mongo)
            print('Expected format: IPV4:PORT')
            sys.exit(1)
        except socket.error:
            print('Invalid MongoDB ip ', args.mongo_host)
            sys.exit(1)

    if args.graphite:
        try:
            (args.graphite_host, args.graphite_port) = args.graphite.split(':')
            socket.inet_aton(args.graphite_host)
            args.graphite_port = int(args.graphite_port)
        except ValueError:
            print('Invalid graphite address format: ', args.graphite)
            print('Expected format: IPV4:PORT')
            sys.exit(1)
        except socket.error:
            print('Invalid graphite ip ', args.graphite_host)
            sys.exit(1)

    if args.pidlatencies:
        args.pid_latency_list = args.pidlatencies.split(",")
    else:
        args.pid_latency_list = None

    analyser = FDInfo(args, traces, output_enabled, err_number)

    analyser.run()

    traces.remove_trace(handle)
    def reset_total(self, start_ts):
        for tid in self.state.tids.keys():
            self.state.tids[tid].allocated_pages = 0
            self.state.tids[tid].freed_pages = 0
        self.state.mm["allocated_pages"] = 0
        self.state.mm["freed_pages"] = 0

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description='Memory usage analysis')
    parser.add_argument('path', metavar="<path/to/trace>", help='Trace path')
    parser.add_argument('-r', '--refresh', type=int,
                        help='Refresh period in seconds', default=0)
    parser.add_argument('--top', type=int, default=10,
                        help='Limit to top X TIDs (default = 10)')
    parser.add_argument('--no-progress', action="store_true",
                        help='Don\'t display the progress bar')
    args = parser.parse_args()

    traces = TraceCollection()
    handle = traces.add_traces_recursive(args.path, "ctf")
    if handle is None:
        sys.exit(1)

    c = MemTop(traces)

    c.run(args)

    for h in handle.values():
        traces.remove_trace(h)
Exemple #4
0
            print('Invalid MongoDB address format: ', args.mongo)
            print('Expected format: IPV4:PORT')
            sys.exit(1)
        except socket.error:
            print('Invalid MongoDB ip ', args.mongo_host)
            sys.exit(1)

    if args.graphite:
        try:
            (args.graphite_host, args.graphite_port) = args.graphite.split(':')
            socket.inet_aton(args.graphite_host)
            args.graphite_port = int(args.graphite_port)
        except ValueError:
            print('Invalid graphite address format: ', args.graphite)
            print('Expected format: IPV4:PORT')
            sys.exit(1)
        except socket.error:
            print('Invalid graphite ip ', args.graphite_host)
            sys.exit(1)

    if args.pidlatencies:
        args.pid_latency_list = args.pidlatencies.split(",")
    else:
        args.pid_latency_list = None

    analyser = FDInfo(args, traces, output_enabled, err_number)

    analyser.run()

    traces.remove_trace(handle)