Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::Counter Struct Reference

#include <counter.hh>

Public Types

using value_type = uint64_t

Public Member Functions

 operator value_type () const noexcept
void operator= (value_type n) noexcept
value_type load () const noexcept
value_type operator++ () noexcept
value_type operator++ (int) noexcept
value_type operator-- () noexcept
value_type operator-- (int) noexcept
value_type operator+= (value_type n) noexcept
value_type operator-= (value_type n) noexcept

Public Attributes

std::atomic< value_type > inner {0}

Static Public Attributes

static bool enabled = getEnv("NIX_SHOW_STATS").value_or("0") != "0"

Detailed Description

An atomic counter aligned on a cache line to prevent false sharing. The counter is only enabled when the NIX_SHOW_STATS environment variable is set. This is to prevent contention on these counters when multi-threaded evaluation is enabled.


The documentation for this struct was generated from the following files:
  • libexpr/include/nix/expr/counter.hh
  • libexpr/eval.cc