# tables


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

------------------------------------------------------------------------

<a
href="https://github.com/cj-mills/cjm-fasthtml-sysmon/blob/main/cjm_fasthtml_sysmon/components/tables.py#L30"
target="_blank" style="float:right; font-size:smaller">source</a>

### render_cpu_processes_table

>  render_cpu_processes_table (top_cpu:list)

*Render the CPU processes table.*

<table>
<colgroup>
<col style="width: 9%" />
<col style="width: 38%" />
<col style="width: 52%" />
</colgroup>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>top_cpu</td>
<td>list</td>
<td>List of dictionaries containing top CPU-consuming process
information</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td><strong>FT</strong></td>
<td><strong>A Div element containing the CPU processes
table</strong></td>
</tr>
</tbody>
</table>

``` python
from cjm_fasthtml_sysmon.monitors.processes import get_process_info

proc_info = get_process_info()
render_cpu_processes_table(top_cpu=proc_info['top_cpu'])
```

``` html
<div id="cpu-processes-table">
  <table class="table table-zebra table-xs w-full">
    <thead>
      <tr>
        <th class="text-xs w-16">PID</th>
        <th class="text-xs">Name</th>
        <th class="text-xs w-20">CPU %</th>
        <th class="text-xs w-24">Memory</th>
        <th class="text-xs">User</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="text-xs">2342</td>
        <td class="text-xs font-medium">python</td>
        <td>
<label class="badge badge-error badge-sm">83.9%</label>        </td>
        <td class="text-xs">78 MB</td>
        <td class="text-xs">runner</td>
      </tr>
      <tr>
        <td class="text-xs">2338</td>
        <td class="text-xs font-medium">python</td>
        <td>
<label class="badge badge-error badge-sm">78.7%</label>        </td>
        <td class="text-xs">77 MB</td>
        <td class="text-xs">runner</td>
      </tr>
      <tr>
        <td class="text-xs">2343</td>
        <td class="text-xs font-medium">python</td>
        <td>
<label class="badge badge-error badge-sm">78.7%</label>        </td>
        <td class="text-xs">77 MB</td>
        <td class="text-xs">runner</td>
      </tr>
      <tr>
        <td class="text-xs">2341</td>
        <td class="text-xs font-medium">python</td>
        <td>
<label class="badge badge-error badge-sm">73.4%</label>        </td>
        <td class="text-xs">80 MB</td>
        <td class="text-xs">runner</td>
      </tr>
      <tr>
        <td class="text-xs">1888</td>
        <td class="text-xs font-medium">provjobd1095981550</td>
        <td>
<label class="badge badge-info badge-sm">21.0%</label>        </td>
        <td class="text-xs">33 MB</td>
        <td class="text-xs">runner</td>
      </tr>
    </tbody>
  </table>
</div>
```

------------------------------------------------------------------------

<a
href="https://github.com/cj-mills/cjm-fasthtml-sysmon/blob/main/cjm_fasthtml_sysmon/components/tables.py#L74"
target="_blank" style="float:right; font-size:smaller">source</a>

### render_memory_processes_table

>  render_memory_processes_table (top_memory:list)

*Render the memory processes table.*

<table>
<colgroup>
<col style="width: 9%" />
<col style="width: 38%" />
<col style="width: 52%" />
</colgroup>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>top_memory</td>
<td>list</td>
<td>List of dictionaries containing top memory-consuming process
information</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td><strong>FT</strong></td>
<td><strong>A Div element containing the memory processes
table</strong></td>
</tr>
</tbody>
</table>

``` python
from cjm_fasthtml_sysmon.monitors.processes import get_process_info

proc_info = get_process_info()
render_memory_processes_table(top_memory=proc_info['top_memory'])
```

``` html
<div id="memory-processes-table">
  <table class="table table-zebra table-xs w-full">
    <thead>
      <tr>
        <th class="text-xs w-16">PID</th>
        <th class="text-xs">Name</th>
        <th class="text-xs w-20">Memory %</th>
        <th class="text-xs w-24">Memory</th>
        <th class="text-xs">User</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="text-xs">2004</td>
        <td class="text-xs font-medium">Runner.Worker</td>
        <td>
<label class="badge badge-info badge-sm">0.8%</label>        </td>
        <td class="text-xs">125 MB</td>
        <td class="text-xs">runner</td>
      </tr>
      <tr>
        <td class="text-xs">1989</td>
        <td class="text-xs font-medium">Runner.Listener</td>
        <td>
<label class="badge badge-info badge-sm">0.6%</label>        </td>
        <td class="text-xs">91 MB</td>
        <td class="text-xs">runner</td>
      </tr>
      <tr>
        <td class="text-xs">2341</td>
        <td class="text-xs font-medium">python</td>
        <td>
<label class="badge badge-info badge-sm">0.5%</label>        </td>
        <td class="text-xs">80 MB</td>
        <td class="text-xs">runner</td>
      </tr>
      <tr>
        <td class="text-xs">2338</td>
        <td class="text-xs font-medium">python</td>
        <td>
<label class="badge badge-info badge-sm">0.5%</label>        </td>
        <td class="text-xs">78 MB</td>
        <td class="text-xs">runner</td>
      </tr>
      <tr>
        <td class="text-xs">2342</td>
        <td class="text-xs font-medium">python</td>
        <td>
<label class="badge badge-info badge-sm">0.5%</label>        </td>
        <td class="text-xs">78 MB</td>
        <td class="text-xs">runner</td>
      </tr>
    </tbody>
  </table>
</div>
```

------------------------------------------------------------------------

<a
href="https://github.com/cj-mills/cjm-fasthtml-sysmon/blob/main/cjm_fasthtml_sysmon/components/tables.py#L118"
target="_blank" style="float:right; font-size:smaller">source</a>

### render_gpu_processes_table_body

>  render_gpu_processes_table_body (gpu_processes:list)

*Render just the GPU processes table body.*

<table>
<colgroup>
<col style="width: 9%" />
<col style="width: 38%" />
<col style="width: 52%" />
</colgroup>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>gpu_processes</td>
<td>list</td>
<td>List of dictionaries containing GPU process information</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td><strong>FT</strong></td>
<td><strong>A Div element containing the GPU processes table
body</strong></td>
</tr>
</tbody>
</table>

------------------------------------------------------------------------

<a
href="https://github.com/cj-mills/cjm-fasthtml-sysmon/blob/main/cjm_fasthtml_sysmon/components/tables.py#L164"
target="_blank" style="float:right; font-size:smaller">source</a>

### render_gpu_processes_table

>  render_gpu_processes_table (gpu_processes:list)

*Render the GPU processes table.*

<table>
<colgroup>
<col style="width: 9%" />
<col style="width: 38%" />
<col style="width: 52%" />
</colgroup>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>gpu_processes</td>
<td>list</td>
<td>List of dictionaries containing GPU process information</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td><strong>FT</strong></td>
<td><strong>A Div element containing the GPU processes
table</strong></td>
</tr>
</tbody>
</table>

``` python
from cjm_fasthtml_sysmon.monitors.gpu import get_gpu_info

gpu_info = get_gpu_info()
render_gpu_processes_table(gpu_processes=gpu_info.get('processes', []))
```

    FATAL ERROR: NVIDIA Management Library (NVML) not found.
    HINT: The NVIDIA Management Library ships with the NVIDIA display driver (available at
          https://www.nvidia.com/Download/index.aspx), or can be downloaded as part of the
          NVIDIA CUDA Toolkit (available at https://developer.nvidia.com/cuda-downloads).
          The lists of OS platforms and NVIDIA-GPUs supported by the NVML library can be
          found in the NVML API Reference at https://docs.nvidia.com/deploy/nvml-api.

``` html
<div id="gpu-processes-table-body" class="bg-base-200 rounded-lg">
  <p class="text-sm text-base-content text-center p-4">No active GPU processes</p>
</div>
```
