ui::testing::PerfCounters¶
Header: winui/testing/PerfCounters.hpp.
How much work the library has done so far in this process, counted as it works: layout passes, measures, text layouts created, ticks and so on. Every count only grows, so a test compares two snapshots, most easily through PerfCountScope. Counts don't flake the way times do, so a test can check that hovering a button measures nothing, and fail when it does.
Example:
ui::testing::HeadlessUI ui = ui::testing::create_headless();
ui.window().set_content(ui.button("Save"));
ui.layout({800, 600});
const ui::testing::PerfCountScope scope;
ui.layout({800, 600}); // nothing changed
REQUIRE(scope.elapsed().measures == 0);
| Field | Type | Default | |
|---|---|---|---|
layout_passes |
std::uint64_t |
0 |
Window::layout() calls that measured and arranged the tree. |
focus_order_builds |
std::uint64_t |
0 |
Times a window rebuilt its tab ring. |
visual_tree_builds |
std::uint64_t |
0 |
Times a window rebuilt its VisualTree snapshot. |
measures |
std::uint64_t |
0 |
Element::measure() calls that reached measure_override(). |
arranges |
std::uint64_t |
0 |
Element::arrange() calls that reached arrange_override(). |
renders |
std::uint64_t |
0 |
Element::render() calls that reached render_override(). |
text_measurements |
std::uint64_t |
0 |
Calls into a TextMeasurer, the headless one or the renderer's. |
text_formats_created |
std::uint64_t |
0 |
Text formats the renderer created. |
text_layouts_created |
std::uint64_t |
0 |
Text layouts the renderer created. |
brushes_created |
std::uint64_t |
0 |
Brushes the renderer created. |
geometries_created |
std::uint64_t |
0 |
Geometries the renderer created. |
stroke_styles_created |
std::uint64_t |
0 |
Stroke styles the renderer created. |
bitmaps_created |
std::uint64_t |
0 |
Bitmaps the renderer created. |
frames |
std::uint64_t |
0 |
Window::render() calls. |
ticks |
std::uint64_t |
0 |
Window::tick() calls. |
element_ticks |
std::uint64_t |
0 |
Element::tick() calls, one per element ticked. |
timer_wakeups |
std::uint64_t |
0 |
Times a window host woke up for a timer. |