mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
57 lines
1.7 KiB
Python
Executable File
57 lines
1.7 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
# utils/profdata_merge/main.py
|
|
#
|
|
# This source file is part of the Swift.org open source project
|
|
#
|
|
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
|
|
# Licensed under Apache License v2.0 with Runtime Library Exception
|
|
#
|
|
# See http://swift.org/LICENSE.txt for license information
|
|
# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
|
|
# This module is used to prevent profile data filling up available disk space
|
|
# by listening for profile data and merging them into a universal profdata
|
|
# file while tests are executing.
|
|
# This file invokes the runner after parsing arguments.
|
|
|
|
from __future__ import print_function
|
|
import sys
|
|
import argparse
|
|
from multiprocessing import Lock
|
|
|
|
import runner
|
|
|
|
SERVER_ADDRESS = ('localhost', 12400)
|
|
TESTS_FINISHED_SENTINEL = "PROFDATA_MERGE_WORKER_TESTS_FINISHED_SENTINEL"
|
|
|
|
printlock = Lock()
|
|
def printsync(msg, config):
|
|
if not config.debug:
|
|
return
|
|
with printlock:
|
|
print(msg, file=sys.stderr)
|
|
|
|
if __name__ == "__main__":
|
|
parser = argparse.ArgumentParser()
|
|
|
|
subparsers = parser.add_subparsers()
|
|
|
|
start = subparsers.add_parser("start")
|
|
start.add_argument("-d", "--debug",
|
|
help="Run in foreground and report status.",
|
|
action="store_true")
|
|
start.add_argument("-o", "--output-dir",
|
|
help="The directory to write the PID file and final profdata file.",
|
|
default="/tmp")
|
|
start.add_argument("--no-remove",
|
|
action="store_true",
|
|
help="Don't remove profraw files after merging them.")
|
|
start.set_defaults(func=runner.start_server)
|
|
|
|
stop = subparsers.add_parser("stop")
|
|
stop.set_defaults(func=runner.stop_server)
|
|
|
|
args = parser.parse_args()
|
|
args.func(args)
|