import os
from IPython.core.interactiveshell import InteractiveShell
from IPython.display import display, Markdown, SVG, HTML, IFrame
from profiling import profiling_code
from profiling.view_profiling_results import get_latest_results_dir, get_initial_results_dir
from profiling.profiling_code_runner import profiling_tasks
InteractiveShell.ast_node_interactivity = "all"
def get_results(dir_name, file_name):
return os.path.join(dir_name, file_name)
def get_file_name(task_name, is_client):
return f'{task_name}_{"client" if is_client else "scheduler"}.svg'
def get_latest_results(task_name, is_client=True):
return get_results(get_latest_results_dir(), get_file_name(task_name, is_client))
def get_initial_results(task_name, is_client=True):
return get_results(get_initial_results_dir(), get_file_name(task_name, is_client))
def display_svg(svg_file_path):
display(IFrame(src=svg_file_path, width='100%', height=800))
??profiling_code.profile_many_empty_tasks
display_svg(get_latest_results('many_empty_tasks'))
display_svg(get_latest_results('many_empty_tasks', is_client=False))
??profiling_code.profile_many_empty_tasks
display_svg(get_latest_results('many_empty_tasks_non_blocking'))
display_svg(get_latest_results('many_empty_tasks_non_blocking', is_client=False))
?? profiling_code.profile_tasks_with_large_data
display_svg(get_latest_results('tasks_with_large_data'))
display_svg(get_latest_results('tasks_with_large_data', is_client=False))
??profiling_code.profile_echo_many_arguments
display_svg(get_latest_results('echo_many_arguments'))
display_svg(get_latest_results('echo_many_arguments', is_client=False))