LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
cache_sojourn.h File Reference

Grid-independent sojourn-weighted average of a cache mean-field transient. More...

#include <cstddef>
#include <vector>
#include "line/num/number.h"
#include "line/util/matrix.h"
#include "line/util/ode.h"
Include dependency graph for cache_sojourn.h:

Go to the source code of this file.

Classes

struct  line::cache::CacheSojournClock< T >
 A phase-type clock: dphi/dt = phi A, phi(t0) = phi0, density phi c. More...
struct  line::cache::CacheSojournResult< T >
 A sojourn average: xbar (empty when wtot is not positive), clock mass, per-user miss rate. More...

Namespaces

namespace  line
 Conservation laws of a layered queueing network, enumerated from its structure.
namespace  line::cache

Functions

template<class T>
CacheSojournClock< T > line::cache::cache_sojourn_clock (const Matrix< T > &D0, const std::vector< T > &pie, double lam)
 The holding-time clock of a random-environment stage whose holding time has sub-generator D0 and entry vector pie, in a drift time unit that is lam times real time: A = D0/lam, c = -D0 1/lam, phi0 = pie, so int_0^T g = F(T/lam).
template<class T, class F>
CacheSojournResult< T > line::cache::cache_sojourn_ode (const F &f, const T &t0, const T &t1, const std::vector< T > &x0, const CacheSojournClock< T > &clk)
 Integrates dx/dt = f(t, x) over [t0, t1] from x0 together with clk; see the file comment.

Detailed Description

Grid-independent sojourn-weighted average of a cache mean-field transient.

Twin of MATLAB cache_sojourn_ode.m, JAR CacheSojourn and Python api/cache/sojourn.py. For a drift dx/dt = f(x) and a phase-type clock with row phase vector phi, dphi/dt = phi A, density g(t) = phi(t) c, it returns

xbar = int_{t0}^{t1} x g dt / int_{t0}^{t1} g dt,   wtot = int_{t0}^{t1} g dt,

by augmenting the state with phi, int g x and int g, so the integrator itself carries the integral. The value is accurate to the ODE tolerance and does NOT depend on any output grid: a Riemann sum over the grid did, and that is what made the adaptive (MATLAB, C++) and fixed-grid (JAR, Python) ENV cache mean fields differ in the third digit.

Copyright (c) 2012-2026, Imperial College London All rights reserved.

Definition in file cache_sojourn.h.