Parma Polyhedra Library requirements
C++ optional computational-weight profiling
  • PPL-LLR-000134
    4. Cooperative computation abandonment PPL-LLR-000134

    At documented native abandonment checkpoints, the runtime shall check pending computational-weight thresholds and caller-owned abandonment requests. A pending caller-owned request shall invoke its supplied exception mechanism without clearing that request; the caller shall remain responsible for clearing it. Binding-owned timeout notification and cleanup shall follow the binding's declared interruption protocol. Cancellation latency shall depend on checkpoint placement and computation progress rather than a promised elapsed-time bound.

    • PPL-HLR-000008
      8. Controlled runtime operation and resource use PPL-HLR-000008

      PPL shall define its initialization, cleanup, runtime configuration and failure behavior, and shall provide the supported mechanisms for controlling long-running computations, so that clients can use the library without violating its documented object and resource-lifetime rules.

  • 6. Thread entry and shared-facility use PPL-LLR-000438

    For each supported thread configuration and language interface, the runtime shall provide the required library and thread initialization and finalization protocol. Correctly initialized threads shall use the thread-specific numerical state required by that configuration. Permitted concurrent use, object-sharing conditions and caller synchronization requirements for shared facilities shall be explicit, including restrictions on computational-weight monitoring and watchdog signal ownership.

    • PPL-HLR-000008
      8. Controlled runtime operation and resource use PPL-HLR-000008

      PPL shall define its initialization, cleanup, runtime configuration and failure behavior, and shall provide the supported mechanisms for controlling long-running computations, so that clients can use the library without violating its documented object and resource-lifetime rules.

1. Optional profiler selection and instrumentation protocol PPL-SPEC-001598

Computational-weight profiling shall be selected by nonzero PPL_PROFILE_ADD_WEIGHT together with NDEBUG. Assertion builds shall retain ordinary weight instrumentation even when the profiling flag is nonzero; profiling-disabled release builds shall retain 🔗 5. Computational-weight instrumentation outside profiling mode. Profiler implementation definitions and automatic calibration shall be present only in the selected profiling configuration. The profiler declaration shall be included after Weightwatch_Traits is complete, with the time declarations required by its interface.

In profiling mode, WEIGHT_BEGIN() shall call Weight_Profiler::begin(). Each expansion of WEIGHT_ADD(d) or WEIGHT_ADD_MUL(d, f) shall own a function-static profiling point identified by that expansion's file and line. The first execution shall evaluate and capture d as the point's Delta; later executions of that expansion shall reuse it. WEIGHT_ADD shall end a one-iteration sample; WEIGHT_ADD_MUL shall evaluate f once per execution, convert it to unsigned int, and end that many iterations. Expressions and their conversions shall be defined. Deltas intended to vary between calls shall use distinct explicit profiling points instead.

The profiler shall borrow its file-name string through its last output or destruction. Calls using the shared clock boundary, calibration and statistics shall be serialized, including in a thread-safe library build. A successful POSIX calling-thread CPU clock shall be available. Timing calls shall occur in the same thread over each interval. Admitted statistics shall remain representable in their unsigned int sample/iteration counters; timing differences shall remain representable in the clock arithmetic. No numerical-library initialization prerequisite shall be imposed by the profiler itself. The ordinary weight counter shall retain 🔗 1. Computational-weight value and current-state binding.

  • PPL-LLR-000134
    4. Cooperative computation abandonment PPL-LLR-000134

    At documented native abandonment checkpoints, the runtime shall check pending computational-weight thresholds and caller-owned abandonment requests. A pending caller-owned request shall invoke its supplied exception mechanism without clearing that request; the caller shall remain responsible for clearing it. Binding-owned timeout notification and cleanup shall follow the binding's declared interruption protocol. Cancellation latency shall depend on checkpoint placement and computation progress rather than a promised elapsed-time bound.

    • PPL-HLR-000008
      8. Controlled runtime operation and resource use PPL-HLR-000008

      PPL shall define its initialization, cleanup, runtime configuration and failure behavior, and shall provide the supported mechanisms for controlling long-running computations, so that clients can use the library without violating its documented object and resource-lifetime rules.

  • 6. Thread entry and shared-facility use PPL-LLR-000438

    For each supported thread configuration and language interface, the runtime shall provide the required library and thread initialization and finalization protocol. Correctly initialized threads shall use the thread-specific numerical state required by that configuration. Permitted concurrent use, object-sharing conditions and caller synchronization requirements for shared facilities shall be explicit, including restrictions on computational-weight monitoring and watchdog signal ownership.

    • PPL-HLR-000008
      8. Controlled runtime operation and resource use PPL-HLR-000008

      PPL shall define its initialization, cleanup, runtime configuration and failure behavior, and shall provide the supported mechanisms for controlling long-running computations, so that clients can use the library without violating its documented object and resource-lifetime rules.

2. Profiler clock boundaries and zero-iteration weight accounting PPL-SPEC-001599

begin() shall replace the shared timestamp with the calling thread CPU time. For end(n) with n > 0, the profiler shall add δn to Weightwatch_Traits::weight using that unsigned counter's modular arithmetic, read a new timestamp, and use the preceding shared boundary as the interval start. A nanosecond-field rollover shall retain the elapsed time across the seconds boundary. After subtracting the calibrated overhead a, it shall supply the elapsed nanoseconds e and per-iteration value x = e ⁄ n to 🔗 3. Profiler sample classification and weighted statistics. Timing arithmetic shall use double and its rounding; adjusted times need not be nonnegative.

For end(0), the profiler shall refresh the shared timestamp without changing the weight, sample counts, iteration counts or accumulated statistics. It shall perform no division by zero or statistical arithmetic for that call. The next sample shall start at the refreshed boundary, so an interval with no iterations shall not be attributed to subsequent work. All calls shall satisfy 🔗 1. Optional profiler selection and instrumentation protocol.

  • PPL-LLR-000134
    4. Cooperative computation abandonment PPL-LLR-000134

    At documented native abandonment checkpoints, the runtime shall check pending computational-weight thresholds and caller-owned abandonment requests. A pending caller-owned request shall invoke its supplied exception mechanism without clearing that request; the caller shall remain responsible for clearing it. Binding-owned timeout notification and cleanup shall follow the binding's declared interruption protocol. Cancellation latency shall depend on checkpoint placement and computation progress rather than a promised elapsed-time bound.

    • PPL-HLR-000008
      8. Controlled runtime operation and resource use PPL-HLR-000008

      PPL shall define its initialization, cleanup, runtime configuration and failure behavior, and shall provide the supported mechanisms for controlling long-running computations, so that clients can use the library without violating its documented object and resource-lifetime rules.

  • 6. Thread entry and shared-facility use PPL-LLR-000438

    For each supported thread configuration and language interface, the runtime shall provide the required library and thread initialization and finalization protocol. Correctly initialized threads shall use the thread-specific numerical state required by that configuration. Permitted concurrent use, object-sharing conditions and caller synchronization requirements for shared facilities shall be explicit, including restrictions on computational-weight monitoring and watchdog signal ownership.

    • PPL-HLR-000008
      8. Controlled runtime operation and resource use PPL-HLR-000008

      PPL shall define its initialization, cleanup, runtime configuration and failure behavior, and shall provide the supported mechanisms for controlling long-running computations, so that clients can use the library without violating its documented object and resource-lifetime rules.

3. Profiler sample classification and weighted statistics PPL-SPEC-001600

Construction shall capture the source location, delta and timing thresholds, and initialize both the valid and discarded statistical classes to zero. It shall leave the shared timing boundary and computational weight unchanged. For each positive-count sample from 🔗 2. Profiler clock boundaries and zero-iteration weight accounting, let x = e ⁄ n. The sample shall be discarded exactly when x < m or (M > 0 ∧ x > M), where m and M are the minimum and maximum thresholds. Equality with either active threshold shall be valid; a nonpositive maximum threshold shall disable the upper test.

In the selected class, the sample count shall increase by one and the iteration count N by n. The elapsed-time sum S shall increase by e, and the weighted square sum Q by ex. The first sample shall set both extrema to x; later samples shall retain the minimum and maximum per-iteration values. The other class shall remain unchanged. Classification shall not suppress the computational-weight increment. Statistics shall use double arithmetic with its rounding. The output mean shall be S ⁄ N, and valid-sample population variance Q ⁄ N − (S ⁄ N)2, the iteration-weighted statistics. Floating rounding can make the computed variance negative; no exact-time or nonnegative rounded variance guarantee shall be imposed. 🔗 1. Optional profiler selection and instrumentation protocol shall apply.

  • PPL-LLR-000134
    4. Cooperative computation abandonment PPL-LLR-000134

    At documented native abandonment checkpoints, the runtime shall check pending computational-weight thresholds and caller-owned abandonment requests. A pending caller-owned request shall invoke its supplied exception mechanism without clearing that request; the caller shall remain responsible for clearing it. Binding-owned timeout notification and cleanup shall follow the binding's declared interruption protocol. Cancellation latency shall depend on checkpoint placement and computation progress rather than a promised elapsed-time bound.

    • PPL-HLR-000008
      8. Controlled runtime operation and resource use PPL-HLR-000008

      PPL shall define its initialization, cleanup, runtime configuration and failure behavior, and shall provide the supported mechanisms for controlling long-running computations, so that clients can use the library without violating its documented object and resource-lifetime rules.

  • 6. Thread entry and shared-facility use PPL-LLR-000438

    For each supported thread configuration and language interface, the runtime shall provide the required library and thread initialization and finalization protocol. Correctly initialized threads shall use the thread-specific numerical state required by that configuration. Permitted concurrent use, object-sharing conditions and caller synchronization requirements for shared facilities shall be explicit, including restrictions on computational-weight monitoring and watchdog signal ownership.

    • PPL-HLR-000008
      8. Controlled runtime operation and resource use PPL-HLR-000008

      PPL shall define its initialization, cleanup, runtime configuration and failure behavior, and shall provide the supported mechanisms for controlling long-running computations, so that clients can use the library without violating its documented object and resource-lifetime rules.

4. Profiler reports, lifetime output and startup calibration PPL-SPEC-001601

output_stats() shall write to std::cout without clearing the stored statistics. Its prefix shall identify the borrowed file and line followed by Weight_Profiler. An unvisited point shall report never reached.. A nonempty valid class shall report samples, iterations, per-iteration extrema, mean, variance and square root of variance. A nonempty discarded class shall report thresholds, samples, iterations, extrema and mean. Both classes shall be reported when nonempty, valid first, with a terminating flushed newline. Numerical formatting shall follow the stream's current state. Stream failures shall follow standard stream behavior; destruction shall call this output operation subject to ordinary nonthrowing-destructor rules.

Automatic initialization in the selected configuration shall set the shared adjustment to tune_adjustment()'s return value. That internal calibration shall begin a shared interval, set the adjustment to zero, and perform 1000 one-iteration measurements at a function-static point with zero delta and zero thresholds. It shall return that point's stored valid minimum. Its statistics shall remain available for the point's destruction report. Calibration shall not change the computational weight. Direct subsequent calls shall again zero the adjustment, append 1000 measurements to that same point, and return its retained minimum; they shall not install the returned adjustment themselves. Calls shall satisfy 🔗 1. Optional profiler selection and instrumentation protocol.