{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "38a867f1-838d-4ede-802d-b84cd0a71ef8", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import plotly.express as px\n", "import plotly.graph_objects as go\n", "from plotly.subplots import make_subplots\n", "\n", "pd.set_option('display.max_columns', None)\n", "pd.set_option('display.float_format', lambda x: '%.5f' % x)" ] }, { "cell_type": "markdown", "id": "86cee194-d588-4d8c-a2fc-83f6dd2c62c0", "metadata": {}, "source": [ "# Jetson Nano Measurements\n", "\n", "Measurements are done using the [`tegrastats`](https://docs.nvidia.com/drive/drive_os_5.1.6.1L/nvvib_docs/index.html#page/DRIVE_OS_Linux_SDK_Development_Guide/Utilities/util_tegrastats.html) tool and a custom wrapper which converts to csv output." ] }, { "cell_type": "code", "execution_count": 2, "id": "a0769ca5-bb8c-4910-89d6-fca1223d64b9", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
TIMERAMSWAPIRAMCPU_0CPU_1CPU_2CPU_3EMC_FREQGR3D_FREQ_UTILGR3D_FREQ_FREQPLLCPUPMICGPUAOthermalAPEPOM_5V_IN_CURPOM_5V_IN_AVGPOM_5V_GPU_CURPOM_5V_GPU_AVGPOM_5V_CPU_CURPOM_5V_CPU_AVGdt
01648029257.7142274900500offoff007639.0000043.000005043.0000045.0000043.00000252111211100414414-10.00000
11648029257.724007490000offoff007639.0000043.000005043.0000045.0000043.00000252111211100414414-9.99022
21648029257.732607490000offoff007639.0000043.000005043.0000045.0000043.00000252111211100414414-9.98162
31648029257.74147749001000offoff007639.0000043.000005043.0000045.0000043.00000252153212100455424-9.97276
41648029257.75011749001000offoff007639.0000043.000005043.0000045.0000043.00000252153212700455430-9.96411
..............................................................................
275091648029553.731342290005050offoff89923040.5000045.000005042.5000046.5000043.750002532812934697540492482286.01712
275101648029553.7421922900000offoff89923040.5000045.500005042.5000046.5000043.750002532812934738540492482286.02797
275111648029553.753662290001000offoff89923040.5000045.000005042.0000046.5000043.750002532812934738540492482286.03944
275121648029553.764842290001000offoff89923040.5000045.000005042.0000046.5000043.750002532812934779540451482286.05062
275131648029553.777272290001000offoff89923040.5000045.000005042.0000046.5000043.750002533172934779540450482286.06305
\n", "

27514 rows × 25 columns

\n", "
" ], "text/plain": [ " TIME RAM SWAP IRAM CPU_0 CPU_1 CPU_2 CPU_3 EMC_FREQ \\\n", "0 1648029257.71422 749 0 0 50 0 off off 0 \n", "1 1648029257.72400 749 0 0 0 0 off off 0 \n", "2 1648029257.73260 749 0 0 0 0 off off 0 \n", "3 1648029257.74147 749 0 0 100 0 off off 0 \n", "4 1648029257.75011 749 0 0 100 0 off off 0 \n", "... ... ... ... ... ... ... ... ... ... \n", "27509 1648029553.73134 2290 0 0 50 50 off off 8 \n", "27510 1648029553.74219 2290 0 0 0 0 off off 8 \n", "27511 1648029553.75366 2290 0 0 100 0 off off 8 \n", "27512 1648029553.76484 2290 0 0 100 0 off off 8 \n", "27513 1648029553.77727 2290 0 0 100 0 off off 8 \n", "\n", " GR3D_FREQ_UTIL GR3D_FREQ_FREQ PLL CPU PMIC GPU \\\n", "0 0 76 39.00000 43.00000 50 43.00000 \n", "1 0 76 39.00000 43.00000 50 43.00000 \n", "2 0 76 39.00000 43.00000 50 43.00000 \n", "3 0 76 39.00000 43.00000 50 43.00000 \n", "4 0 76 39.00000 43.00000 50 43.00000 \n", "... ... ... ... ... ... ... \n", "27509 99 230 40.50000 45.00000 50 42.50000 \n", "27510 99 230 40.50000 45.50000 50 42.50000 \n", "27511 99 230 40.50000 45.00000 50 42.00000 \n", "27512 99 230 40.50000 45.00000 50 42.00000 \n", "27513 99 230 40.50000 45.00000 50 42.00000 \n", "\n", " AO thermal APE POM_5V_IN_CUR POM_5V_IN_AVG POM_5V_GPU_CUR \\\n", "0 45.00000 43.00000 25 2111 2111 0 \n", "1 45.00000 43.00000 25 2111 2111 0 \n", "2 45.00000 43.00000 25 2111 2111 0 \n", "3 45.00000 43.00000 25 2153 2121 0 \n", "4 45.00000 43.00000 25 2153 2127 0 \n", "... ... ... ... ... ... ... \n", "27509 46.50000 43.75000 25 3281 2934 697 \n", "27510 46.50000 43.75000 25 3281 2934 738 \n", "27511 46.50000 43.75000 25 3281 2934 738 \n", "27512 46.50000 43.75000 25 3281 2934 779 \n", "27513 46.50000 43.75000 25 3317 2934 779 \n", "\n", " POM_5V_GPU_AVG POM_5V_CPU_CUR POM_5V_CPU_AVG dt \n", "0 0 414 414 -10.00000 \n", "1 0 414 414 -9.99022 \n", "2 0 414 414 -9.98162 \n", "3 0 455 424 -9.97276 \n", "4 0 455 430 -9.96411 \n", "... ... ... ... ... \n", "27509 540 492 482 286.01712 \n", "27510 540 492 482 286.02797 \n", "27511 540 492 482 286.03944 \n", "27512 540 451 482 286.05062 \n", "27513 540 450 482 286.06305 \n", "\n", "[27514 rows x 25 columns]" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "def read_csv(path):\n", " df = pd.read_csv(path)\n", " df[\"dt\"] = df[\"TIME\"] - df[\"TIME\"][0] - 10\n", " \n", " return df\n", "df = read_csv(\"jetson-nano-clients_10-minpower-vhf.csv\")\n", "df" ] }, { "cell_type": "markdown", "id": "131ed76f", "metadata": {}, "source": [ "### Measurements: Dynamic addition of clients (1, 5 and 10 clients) at custom low power (1000 hz sampling rate)" ] }, { "cell_type": "code", "execution_count": 3, "id": "c5877b34", "metadata": {}, "outputs": [], "source": [ "def plot_power2(df):\n", " fig = make_subplots(specs=[[{\"secondary_y\": True}]])\n", " fig.layout.margin = go.layout.Margin(l=10, r=10, b=10, t=10)\n", "\n", " fig.add_trace(go.Scatter(x=df[\"dt\"], y=df[\"POM_5V_CPU_CUR\"].rolling(200).mean(), name=\"CPU Power\"))\n", " fig.add_trace(go.Scatter(x=df[\"dt\"], y=df[\"POM_5V_GPU_CUR\"].rolling(200).mean(), name=\"GPU Power\"))\n", " fig.add_trace(go.Scatter(x=df[\"dt\"], y=df[\"POM_5V_IN_CUR\"].rolling(200).mean(), name=\"Total Power\"))\n", "\n", " #fig.add_trace(go.Scatter(x=df[\"dt\"], y=df[\"CPU Usage\"].rolling(10).mean(), name=\"CPU Usage\"), secondary_y=True,)\n", " #fig.add_trace(go.Scatter(x=df[\"dt\"], y=df[\"GR3D_FREQ_UTIL\"].rolling(50).mean(), name=\"GPU Usage\"), secondary_y=True,)\n", "\n", " fig.add_trace(go.Scatter(x=df[\"dt\"], y=df[\"GR3D_FREQ_UTIL\"].rolling(500).mean(), name=\"GPU Utilization\",\n", " line = dict(color='#FFA15A', dash='dot')), secondary_y=True,)\n", " fig.add_trace(go.Scatter(x=df[\"dt\"], y=(df[\"CPU_0\"]+df[\"CPU_1\"]).rolling(500).mean(), name=\"CPU Utilization\",\n", " line = dict(color='#19D3F3', dash='dot')), secondary_y=True,)\n", "\n", "\n", " fig.update_xaxes(title_text=\"Time (s)\")\n", " fig.update_yaxes(title_text=\"Power Consumption (mW)\")\n", " fig.update_yaxes(title_text=\"Utilization (%)\", secondary_y=True)\n", " \n", " return fig" ] }, { "cell_type": "code", "execution_count": 4, "id": "c4b589a0", "metadata": {}, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "fig = plot_power2(df)\n", "fig.add_vline(x=7, annotation_text=\"Start\")\n", "fig.add_vline(x=36, annotation_text=\"Pipeline Running\")\n", "fig.add_vline(x=120, annotation_text=\"Power Client 2-5\")\n", "fig.add_vline(x=180, annotation_text=\"Power Client 6-10\")\n", "\n", "fig.show(\"notebook\")" ] }, { "cell_type": "code", "execution_count": 5, "id": "0d0eb543", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Custom low power mode: 1 Client: 3.18W, 5 Clients: 3.16W, 10 Clients: 3.13W\n" ] } ], "source": [ "# power consumption of 1 client\n", "c1 = df[5000:6000][\"POM_5V_IN_CUR\"].mean()\n", "# power consumption of 5 clients\n", "c5 = df[17000:18000][\"POM_5V_IN_CUR\"].mean()\n", "# power consumption of 5 clients\n", "c10 = df[23000:24000][\"POM_5V_IN_CUR\"].mean()\n", "\n", "print(f\"Custom low power mode: 1 Client: {c1/1000:.3}W, 5 Clients: {c5/1000:.3}W, 10 Clients: {c10/1000:.3}W\")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.10" } }, "nbformat": 4, "nbformat_minor": 5 }