import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
from plotly.subplots import make_subplots
pd.set_option('display.max_columns', None)
pd.set_option('display.float_format', lambda x: '%.5f' % x)
Measurements are done using the tegrastats
tool and a custom wrapper which converts to csv output.
def read_csv(path):
df = pd.read_csv(path)
df["dt"] = df["TIME"] - df["TIME"][0] - 10
return df
df = read_csv("jetson-nano-clients_10-minpower-vhf.csv")
df
def plot_power2(df):
fig = make_subplots(specs=[[{"secondary_y": True}]])
fig.layout.margin = go.layout.Margin(l=10, r=10, b=10, t=10)
fig.add_trace(go.Scatter(x=df["dt"], y=df["POM_5V_CPU_CUR"].rolling(200).mean(), name="CPU Power"))
fig.add_trace(go.Scatter(x=df["dt"], y=df["POM_5V_GPU_CUR"].rolling(200).mean(), name="GPU Power"))
fig.add_trace(go.Scatter(x=df["dt"], y=df["POM_5V_IN_CUR"].rolling(200).mean(), name="Total Power"))
#fig.add_trace(go.Scatter(x=df["dt"], y=df["CPU Usage"].rolling(10).mean(), name="CPU Usage"), secondary_y=True,)
#fig.add_trace(go.Scatter(x=df["dt"], y=df["GR3D_FREQ_UTIL"].rolling(50).mean(), name="GPU Usage"), secondary_y=True,)
fig.add_trace(go.Scatter(x=df["dt"], y=df["GR3D_FREQ_UTIL"].rolling(500).mean(), name="GPU Utilization",
line = dict(color='#FFA15A', dash='dot')), secondary_y=True,)
fig.add_trace(go.Scatter(x=df["dt"], y=(df["CPU_0"]+df["CPU_1"]).rolling(500).mean(), name="CPU Utilization",
line = dict(color='#19D3F3', dash='dot')), secondary_y=True,)
fig.update_xaxes(title_text="Time (s)")
fig.update_yaxes(title_text="Power Consumption (mW)")
fig.update_yaxes(title_text="Utilization (%)", secondary_y=True)
return fig
fig = plot_power2(df)
fig.add_vline(x=7, annotation_text="Start")
fig.add_vline(x=36, annotation_text="Pipeline Running")
fig.add_vline(x=120, annotation_text="Power Client 2-5")
fig.add_vline(x=180, annotation_text="Power Client 6-10")
fig.show("notebook")