def mem_monitor_procrank_main(): init_path_vars() if g_flag_build_report: MonitorUtils.g_create_report_dir(g_report_dir_path) f_report = MonitorUtils.g_create_and_open_report_with_append(g_report_file_path) try: create_report_header(f_report) init_default_content() if g_flag_only_process: loop_for_subprocess(subprocess_run_cmd_and_write_report_for_process, f_report) elif g_flag_only_total: loop_for_subprocess(subprocess_run_cmd_and_write_report_for_total, f_report) elif g_flag_process_total: loop_for_subprocess(subprocess_run_cmd_and_write_report_for_process_and_total, f_report) elif g_flag_all: loop_for_subprocess(subprocess_run_cmd_and_write_report_for_all, f_report) else: print 'Error: no monitor flag set and exit.' exit(1) finally: create_report_trailer(f_report) f_report.close() if g_flag_parse_report: # create_report_sorted_by_category() create_separated_report_for_process_service_total()
def mem_monitor_procrank_main_for_all(): f_report = MUtils.g_create_and_open_report_with_append( g_report_file_for_all_path) try: create_and_write_report_header(f_report) loop_for_subprocess(run_cmd_and_write_report_for_all, f_report) create_and_write_report_trailer(f_report) finally: file_flush_and_close(f_report)
def run_top_cmd_main(): f_report = MonitorUtils.g_create_and_open_report_with_append( g_report_file_path_top) try: write_single_line_report(f_report, build_report_header_for_top_cmd()) loop_process(run_top_cmd_and_write_output, f_report) finally: write_single_line_report(f_report, build_report_trailer_for_top_cmd()) file_close_and_flush(f_report)
def run_top_cmd_for_total_pkg_main(): if g_report_file_path_top_for_pkg_and_total == '': print 'Error, g_report_file_path_top_for_pkg_and_total is null!' exit(1) f_report = MUtils.g_create_and_open_report_with_append(g_report_file_path_top_for_pkg_and_total) try: title_line = build_report_header_title_line_for_top() info_line = build_report_header_info_line_for_top(g_pkg_name, g_monitor_interval) write_multiple_lines_report(f_report, (title_line, info_line)) loop_process(run_top_cmd_for_total_pkg_and_write_output, f_report) write_single_line_report(f_report, build_report_trailer_line_for_top()) finally: file_flush_and_close(f_report)
def run_top_cmd_for_total_pkg_main(): if g_report_file_path_top_for_pkg_and_total == '': print 'Error, g_report_file_path_top_for_pkg_and_total is null!' exit(1) f_report = MUtils.g_create_and_open_report_with_append( g_report_file_path_top_for_pkg_and_total) try: title_line = build_report_header_title_line_for_top() info_line = build_report_header_info_line_for_top( g_pkg_name, g_monitor_interval) write_multiple_lines_report(f_report, (title_line, info_line)) loop_process(run_top_cmd_for_total_pkg_and_write_output, f_report) write_single_line_report(f_report, build_report_trailer_line_for_top()) finally: file_flush_and_close(f_report)
def prepare_report_file(): MUtils.g_create_report_dir(g_report_root_path) f_report = MUtils.g_create_and_open_report_with_append(g_report_file_path) return f_report
def prepare_report_file(): MUtils.g_create_report_dir(g_report_root_path) f_report = MUtils.g_create_and_open_report_with_append(g_report_file_path) return f_report