(df, output_path)
| 45 | |
| 46 | |
| 47 | def plot_compile_analysis(df, output_path): |
| 48 | df_sorted_by_time = df.sort_values(by='Value', ascending=False) |
| 49 | df_sorted_by_total_time = df.groupby( |
| 50 | 'Operation')['Value'].sum().sort_values(ascending=False).reset_index() |
| 51 | df_sorted_by_avg_time = df.groupby('Operation')['Value'].mean( |
| 52 | ).sort_values(ascending=False).reset_index() |
| 53 | df_counts = df['Operation'].value_counts().reset_index() |
| 54 | |
| 55 | fig = make_subplots(rows=2, |
| 56 | cols=4, |
| 57 | row_heights=[0.4, 0.6], |
| 58 | specs=[[{ |
| 59 | 'type': 'bar' |
| 60 | }, { |
| 61 | 'type': 'bar' |
| 62 | }, { |
| 63 | 'type': 'bar' |
| 64 | }, { |
| 65 | 'type': 'bar' |
| 66 | }], |
| 67 | [{ |
| 68 | 'type': 'scatter', |
| 69 | 'colspan': 4 |
| 70 | }, None, None, None]], |
| 71 | subplot_titles=('Time Taken per Line', |
| 72 | 'Total Time Taken per Operation', |
| 73 | 'Avg Time Taken per Operation', |
| 74 | 'Number of times Operation called', |
| 75 | 'Compile Time Series Graph'), |
| 76 | vertical_spacing=0.25) |
| 77 | |
| 78 | fig.add_trace(go.Bar( |
| 79 | x=df_sorted_by_time['Operation: Line Number'], |
| 80 | y=df_sorted_by_time['Value'], |
| 81 | name='Time Taken per Line', |
| 82 | marker=dict(color='red'), |
| 83 | hoverinfo='x+y', |
| 84 | ), |
| 85 | row=1, |
| 86 | col=1) |
| 87 | |
| 88 | fig.add_trace(go.Bar(x=df_sorted_by_total_time['Operation'], |
| 89 | y=df_sorted_by_total_time['Value'], |
| 90 | name='Total Time Taken per Operation', |
| 91 | marker=dict(color='green'), |
| 92 | hoverinfo='x+y'), |
| 93 | row=1, |
| 94 | col=2) |
| 95 | |
| 96 | fig.add_trace(go.Bar(x=df_sorted_by_avg_time['Operation'], |
| 97 | y=df_sorted_by_avg_time['Value'], |
| 98 | name='Avg Time Taken per Operation', |
| 99 | marker=dict(color='green'), |
| 100 | hoverinfo='x+y'), |
| 101 | row=1, |
| 102 | col=3) |
| 103 | |
| 104 | fig.add_trace(go.Bar(x=df_counts['Operation'], |
no test coverage detected