def show_edges_temporal_sort(ns): conf = open_logdag_config(ns) args = arguments.name2args(ns.argname, conf) from . import edge_search ldag = showdag.LogDAG(args) ldag.load() g = showdag.apply_filter(ldag, ns.filters, th=ns.threshold) if ns.detail: context = "detail" elif ns.instruction: context = "instruction" else: context = "edge" from logdag import dtutil if ns.timestr_end is None: dt = dtutil.shortstr2dt(ns.timestr) time_condition = {"time": dt} else: dts = dtutil.shortstr2dt(ns.timestr) dte = dtutil.shortstr2dt(ns.timestr_end) time_condition = {"time_range": (dts, dte)} from ..__main__ import _parse_condition search_condition = _parse_condition(ns.conditions) print( edge_search.edge_temporal_sort(ldag, time_condition, search_condition=search_condition, reverse=ns.reverse, view_context=context, load_cache=(not ns.nocache), graph=g))
def draw_graph_diff(ns): conf_fn1, conf_fn2 = ns.confs conf1 = arguments.open_logdag_config(conf_fn1) conf2 = arguments.open_logdag_config(conf_fn2) lv = logging.DEBUG if ns.debug else logging.INFO am_logger = logging.getLogger("amulog") config.set_common_logging(conf1, logger=[_logger, am_logger], lv=lv) dts = dtutil.shortstr2dt(ns.timestr) dte = dts + config.getdur(conf1, "dag", "unit_term") output = ns.filename from . import comparison cevmap, cgraph = comparison.edge_set_diff(conf1, conf2, (dts, dte)) from . import draw rgraph = draw.relabel_nodes(cgraph, cevmap) draw.graph_nx(output, rgraph) print(output)
def draw_graph_diff(ns): l_conffp = ns.confs assert len(l_conffp) == 2 openconf = lambda c: config.open_config( c, ex_defaults=[arguments.DEFAULT_CONFIG]) conf1, conf2 = [openconf(c) for c in l_conffp] lv = logging.DEBUG if ns.debug else logging.INFO am_logger = logging.getLogger("amulog") config.set_common_logging(conf1, logger=[_logger, am_logger], lv=lv) dts = dtutil.shortstr2dt(ns.timestr) dte = dts + config.getdur(conf1, "dag", "unit_term") output = ns.filename from . import comp_conf cevmap, cgraph = comp_conf.edge_set_diff(conf1, conf2, (dts, dte)) from . import draw rgraph = draw.relabel_graph(conf1, cgraph, cevmap) draw.graph_nx(output, rgraph) print(output)
ax.set_xlabel("Value") ax.set_ylabel("Appearance rate") ax.set_xticks(x) ax.bar(x[:-1], y) ax.plot(x[:-1], cum) plt.savefig(output) plt.close() print(output) if __name__ == "__main__": if len(sys.argv) < 4: sys.exit("usage: {0} MODE CONF GID HOST DTS DTE").format(sys.argv[0]) from logdag import arguments conf = config.open_config(sys.argv[1], ex_defaults=[arguments.DEFAULT_CONFIG]) mode = sys.argv[2] gid = int(sys.argv[3]) host = sys.argv[4] dts = dtutil.shortstr2dt(sys.argv[5]) dte = dtutil.shortstr2dt(sys.argv[6]) if mode == "show": print(show_dist_values(conf, gid, host, (dts, dte))) elif mode == "plot": plot_dist_values(conf, gid, host, (dts, dte)) else: raise NotImplementedError