File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -953,26 +953,8 @@ async def do_execute(
953953 self.get_perfdata_index(-1, metrics[1:]), nmetrics)
954954 return self.standard_reply()
955955 """
956- if code .startswith ("%%display_graph_for_last" ):
957- if not len (kernel_context .perfdata_handler .get_perfdata_history ()):
958- self .cell_output ("No performance data available." )
959- time_indices = kernel_context .perfdata_handler .get_time_indices ()[- 1 ]
960- if time_indices :
961- sub_idxs = [x [0 ] for x in time_indices [0 ]]
962- self .cell_output (
963- f"Cell seemed to be tracked in multi cell"
964- " mode. Got performance data for the"
965- f" following sub cells: { sub_idxs } "
966- )
967- perfvis .draw_performance_graph (
968- self .nodelist ,
969- kernel_context .perfdata_handler .get_perfdata_history ()[- 1 ],
970- kernel_context .gpu_avail ,
971- time_indices ,
972- )
973- return self .standard_reply ()
974956
975- elif code .startswith ("%%display_code_for_index" ):
957+ if code .startswith ("%%display_code_for_index" ):
976958 if len (code .split (" " )) == 1 :
977959 self .cell_output (
978960 "No index specified. Use: %%display_code_for_index index" ,
Original file line number Diff line number Diff line change @@ -82,6 +82,25 @@ def display_graph_for_index(self, line):
8282 time_indices ,
8383 )
8484
85+ @line_magic
86+ def display_graph_for_last (self , line ):
87+ if not len (kernel_context .perfdata_handler .get_perfdata_history ()):
88+ self .cell_output ("No performance data available." )
89+ time_indices = kernel_context .perfdata_handler .get_time_indices ()[- 1 ]
90+ if time_indices :
91+ sub_idxs = [x [0 ] for x in time_indices [0 ]]
92+ self .cell_output (
93+ f"Cell seemed to be tracked in multi cell"
94+ " mode. Got performance data for the"
95+ f" following sub cells: { sub_idxs } "
96+ )
97+ perfvis .draw_performance_graph (
98+ self .nodelist ,
99+ kernel_context .perfdata_handler .get_perfdata_history ()[- 1 ],
100+ kernel_context .gpu_avail ,
101+ time_indices ,
102+ )
103+
85104
86105 @cell_magic
87106 def set_perfmonitor (self , line , code ):
You can’t perform that action at this time.
0 commit comments