Nodes/ComfyUI-MakkiTools/timer(mki-计时器)
ComfyUI Node

timer(mki-计时器)

Time any part of your workflow with timer(mki-计时器) — the stopwatch for ComfyUI graphs

By MakkiShizu·Created about a year ago·Updated 7 months ago· 9
timer(mki-计时器)
  • any
  • timer
  • any
  • timer
  • time_ms
  • time_str
mode
formatauto

ComfyUI shows you total generation time, but not "how long was the upscale, vs. the sampler, vs. that IPAdapter that's eating my lunch." If you're trying to shave seconds off a workflow, you need per-section timing. timer_makki (display name "timer(mki-计时器)") is a start/stop stopwatch that measures the wall-clock time between two points in the graph.

It's a two-node affair, which trips people up the first time. You place one timer node in start mode and a second one in stop mode, chain your work between them, and the stop node reports how long that middle section took.

How it works

A timer object of type TIMER_MAKKI flows from the start node to the stop node - it's the "wire" that connects the pair. The start node stamps a start time onto it and hands it through; the stop node reads the wall clock when it runs and computes the delta. You also get the result out as both a formatted string and a raw millisecond integer, so you can log it, display it, or feed it into a text writer.

The inputs and outputs

  • mode - start or stop. This is the whole job.
  • format - ms, s, m, or auto (default). auto picks milliseconds under a second, seconds under a minute, and minutes beyond.
  • any (optional) - any input type, passed through untouched. This is the clever part: run whatever you're timing through any, and the timer rides along with the data instead of needing its own connection path.
  • timer (optional) - the TIMER_MAKKI object from the start node.

Outputs from the stop node: any (passthrough), timer, time_ms (INT), and time_str (STRING). The node is marked as an output node, and the stop node's result shows up in the UI widget thanks to the pack's JS, so you see the number right on the node.

Practical notes

  • The start and stop nodes are different instances of the same node type. Same class, different mode setting. Make sure the start node's timer output feeds the stop node's timer input, or stop mode raises an error.
  • The stop node forces a re-run every execution (the node reports IS_CHANGED as always-changed), so timing is never cached away. That's exactly what you want from a stopwatch.
  • Time is measured between when the start node executes and when the stop node executes. Since nodes run in dependency order, anything between them in the graph - even in a different branch - counts toward the interval if it executes in between. Keep the timed section tight if you want clean numbers.

Install via ComfyUI Manager (search "ComfyUI-MakkiTools"), or clone the pack into custom_nodes and pip install -r requirements.txt, then restart. Nothing heavy here - this node has zero extra dependencies.

Is it a must-have? No. But when you're profiling a slow workflow, a stopwatch you can drop into the graph beats guessing, and the pass-through any port means you never have to restructure your graph to use it.

CategoryMakkiTools

Inputs (4)

NameTypeDefaultDescription
modeCOMBOTimer mode 计时器模式
formatCOMBOautoTime display format 时间显示格式
anyopt*Any input to pass through 任意输入通过
timeroptTIMER_MAKKITimer object 计时器对象

Outputs (4)

NameTypeDescription
any*
timerTIMER_MAKKI
time_msINT
time_strSTRING