beetlebug▾
/

ztcl::meter get

Gives the dict of the counts of a meter.

ztcl::meter get NAME

Description

Gives a dict with these keys:

The counts of a thread come in at its safe points, at the end of each script that thread::send runs in it, and at its end, so a read from another thread sees the counts of the last such point. A thread of the level process adds its counts at its end only. The wasm and WASI builds read no clock, so the counts of time are 0 there.

Arguments

ArgumentTypeDefaultDescription
NAMEstringrequiredThe name of a meter.

Returns

A dict.

Examples

Each example of this page runs after package require ztcl::json.

% ztcl::meter create demo
> dict keys [ztcl::meter get demo]
name units wall_us cpu_us mem_peak mem_avg mem_byte_ms threads io connections net process vm budget left

% ztcl::meter create demo
> set m [ztcl::meter get demo]
> list [dict get $m threads] [dict get $m io file]
{interp 0 process 0} {read 0 write 0}

% interp create k -meter g
> k eval {set a 1; set b 2}
> dict get [ztcl::meter get g] units
2

Errors

% ztcl::meter get nope
no meter "nope"
-errorcode ZTCL METER NAME

% ztcl::meter get
wrong # args: should be "ztcl::meter get name"
-errorcode TCL WRONGARGS

Facts

Capability
meter. A new interpreter does not have it until the host turns it on.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.1

See also