{# docker/widget_resources.html — dashboard widget: the containers using the most CPU (averaged over the last few minutes, so the order holds still), each with its CPU in cores and memory in bytes. The CPU bar is a share of the host's CPUs; the memory bar a share of the container's limit, or of the host's memory when no limit is set. #} {% from "docker/_usage.html" import cpu, mem %} {% if not rows %}
No running containers.
{% else %} {% macro bar(label, pct, tone, text, title) %}
{{ label }}
{% if pct is not none %}
{% endif %}
{{ text }}
{% endmacro %}
Busiest by CPU, {{ minutes }}-minute average
{% for r in rows %} {% set u = r.usage %}
{{ r.label }}{% if multi_host %} · {{ r.host_name }}{% endif %}
{% if u.cores is not none %} {{ bar("CPU", u.cpu_share, status_class(u.cpu_share, 'cpu'), cpu(u), ("%.1f%% of the host's %d core%s" % (u.cpu_share, u.cpus, "" if u.cpus == 1 else "s")) if u.cpus else "Host core count unknown") }} {% endif %} {% if u.mem_bytes is not none %} {{ bar("MEM", u.mem_pct if u.mem_of else none, status_class(u.mem_pct, 'mem') if u.mem_of else 'unknown', mem(u), ("%.1f%% of %s" % (u.mem_pct, u.mem_of)) if u.mem_of and u.mem_pct is not none else "") }} {% endif %}
{% endfor %}
{% endif %}