Timer Methods - danielep71/VBA-PERFORMANCE_MANAGER GitHub Wiki

Timer Methods

This page explains the six timing backends supported by cPerformanceManager, what each one measures, and when each one is appropriate.

Method map

cPerformanceManager supports the following timing methods:

  • 1 = Timer
  • 2 = GetTickCount / GetTickCount64
  • 3 = timeGetTime
  • 4 = timeGetSystemTime (MMTIME / TIME_MS)
  • 5 = QueryPerformanceCounter (QPC)
  • 6 = Now() * 86400

In most cases, method 5 is the preferred benchmark path.

The most important distinction

There are three conceptual families here:

VBA-native clocks

  • Method 1: Timer
  • Method 6: Now() * 86400

Windows millisecond counters

  • Method 2: GetTickCount / GetTickCount64
  • Method 3: timeGetTime
  • Method 4: timeGetSystemTime

High-resolution performance counter

  • Method 5: QueryPerformanceCounter (QPC)

Recommended choices

Best default

Use:

cPM.StartTimer 5

Practical fallback

If QPC is unavailable or you deliberately want a simpler uptime-style counter, method 2 is the next most practical choice.

Teaching / comparison methods

Methods 1 and 6 are useful for comparison, diagnostics, or teaching, but they are not the preferred benchmark path.

More specialized methods

Methods 3 and 4 are valid and supported, but they are more specialized than QPC.

About AlignToNextTick

StartTimer supports:

cPM.StartTimer 5, True

This aligns the start capture to the next observable tick. Use it only in deliberate micro-benchmark scenarios, because it adds polling overhead.