mirror of https://github.com/m-labs/artiq.git
artiq_coremgmt: remove unnecessary DeviceManager
This commit is contained in:
parent
167e97efd2
commit
fc09144baa
|
@ -5,7 +5,6 @@ import struct
|
||||||
|
|
||||||
from artiq.tools import verbosity_args, init_logger
|
from artiq.tools import verbosity_args, init_logger
|
||||||
from artiq.master.databases import DeviceDB
|
from artiq.master.databases import DeviceDB
|
||||||
from artiq.master.worker_db import DeviceManager
|
|
||||||
from artiq.coredevice.comm_kernel import CommKernel
|
from artiq.coredevice.comm_kernel import CommKernel
|
||||||
from artiq.coredevice.comm_mgmt import CommMgmt
|
from artiq.coredevice.comm_mgmt import CommMgmt
|
||||||
from artiq.coredevice.profiler import CallgrindWriter
|
from artiq.coredevice.profiler import CallgrindWriter
|
||||||
|
@ -134,67 +133,63 @@ def main():
|
||||||
args = get_argparser().parse_args()
|
args = get_argparser().parse_args()
|
||||||
init_logger(args)
|
init_logger(args)
|
||||||
|
|
||||||
device_mgr = DeviceManager(DeviceDB(args.device_db))
|
core_addr = DeviceDB(args.device_db).get("core")["arguments"]["host"]
|
||||||
try:
|
mgmt = CommMgmt(core_addr)
|
||||||
core_addr = DeviceDB(args.device_db).get("core")["arguments"]["host"]
|
|
||||||
mgmt = CommMgmt(core_addr)
|
|
||||||
|
|
||||||
if args.tool == "log":
|
if args.tool == "log":
|
||||||
if args.action == "set_level":
|
if args.action == "set_level":
|
||||||
mgmt.set_log_level(args.level)
|
mgmt.set_log_level(args.level)
|
||||||
if args.action == "set_uart_level":
|
if args.action == "set_uart_level":
|
||||||
mgmt.set_uart_log_level(args.level)
|
mgmt.set_uart_log_level(args.level)
|
||||||
if args.action == "clear":
|
if args.action == "clear":
|
||||||
mgmt.clear_log()
|
mgmt.clear_log()
|
||||||
if args.action == None:
|
if args.action == None:
|
||||||
print(mgmt.get_log(), end="")
|
print(mgmt.get_log(), end="")
|
||||||
|
|
||||||
if args.tool == "config":
|
if args.tool == "config":
|
||||||
if args.action == "read":
|
if args.action == "read":
|
||||||
value = mgmt.config_read(args.key)
|
value = mgmt.config_read(args.key)
|
||||||
if not value:
|
if not value:
|
||||||
print("Key {} does not exist".format(args.key))
|
print("Key {} does not exist".format(args.key))
|
||||||
else:
|
else:
|
||||||
print(value)
|
print(value)
|
||||||
if args.action == "write":
|
if args.action == "write":
|
||||||
for key, value in args.string:
|
for key, value in args.string:
|
||||||
mgmt.config_write(key, value.encode("utf-8"))
|
mgmt.config_write(key, value.encode("utf-8"))
|
||||||
for key, filename in args.file:
|
for key, filename in args.file:
|
||||||
with open(filename, "rb") as fi:
|
with open(filename, "rb") as fi:
|
||||||
mgmt.config_write(key, fi.read())
|
mgmt.config_write(key, fi.read())
|
||||||
if args.action == "remove":
|
if args.action == "remove":
|
||||||
for key in args.key:
|
for key in args.key:
|
||||||
mgmt.config_remove(key)
|
mgmt.config_remove(key)
|
||||||
if args.action == "erase":
|
if args.action == "erase":
|
||||||
mgmt.config_erase()
|
mgmt.config_erase()
|
||||||
|
|
||||||
if args.tool == "reboot":
|
if args.tool == "reboot":
|
||||||
mgmt.reboot()
|
mgmt.reboot()
|
||||||
|
|
||||||
if args.tool == "hotswap":
|
if args.tool == "hotswap":
|
||||||
mgmt.hotswap(args.image.read())
|
mgmt.hotswap(args.image.read())
|
||||||
|
|
||||||
if args.tool == "profile":
|
if args.tool == "profile":
|
||||||
if args.action == "start":
|
if args.action == "start":
|
||||||
mgmt.start_profiler(args.interval, args.hits_size, args.edges_size)
|
mgmt.start_profiler(args.interval, args.hits_size, args.edges_size)
|
||||||
elif args.action == "stop":
|
elif args.action == "stop":
|
||||||
mgmt.stop_profiler()
|
mgmt.stop_profiler()
|
||||||
elif args.action == "save":
|
elif args.action == "save":
|
||||||
hits, edges = mgmt.get_profile()
|
hits, edges = mgmt.get_profile()
|
||||||
writer = CallgrindWriter(args.output, args.firmware, "or1k-linux",
|
writer = CallgrindWriter(args.output, args.firmware, "or1k-linux",
|
||||||
args.compression, args.demangle)
|
args.compression, args.demangle)
|
||||||
writer.header()
|
writer.header()
|
||||||
for addr, count in hits.items():
|
for addr, count in hits.items():
|
||||||
writer.hit(addr, count)
|
writer.hit(addr, count)
|
||||||
for (caller, callee), count in edges.items():
|
for (caller, callee), count in edges.items():
|
||||||
writer.edge(caller, callee, count)
|
writer.edge(caller, callee, count)
|
||||||
|
|
||||||
if args.tool == "debug":
|
if args.tool == "debug":
|
||||||
if args.action == "allocator":
|
if args.action == "allocator":
|
||||||
mgmt.debug_allocator()
|
mgmt.debug_allocator()
|
||||||
|
|
||||||
finally:
|
|
||||||
device_mgr.close_devices()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in New Issue