Пример #1
0
int main() {
	
	Counter c;
	printf("c=%d\n", c.get());
	c.inc();
	printf("c=%d\n", c.get());
	c.inc(2);
	printf("c=%d\n", c.get());
	c.dec();
	printf("c=%d\n", c.get());
	c.dec(2);
	printf("c=%d\n", c.get());
	c.reset(5);
	printf("c=%d\n", c.get());

	return 0;
}
Пример #2
0
 /** Update counters that are lazily-computed. */
 virtual void finalizeCounters() {
   numTotalMemoryAccesses = numReadHits.get() + numReadRemoteHits.get() + numReadMisses.get()
       + numWriteHits.get() + numWriteRemoteHits.get() + numWriteMisses.get() + numUpgradeMisses.get();
 }
Пример #3
0
static int receiveConstRef(const Counter& counter)
{
    BOOST_CHECK_EQUAL(counter.get(), 24);
    return counter.get();
}
Пример #4
0
static int receiveRef(Counter& counter)
{
    BOOST_CHECK_EQUAL(counter.get(), 42);
    counter.set(24);
    return counter.get();
}
Пример #5
0
static int receiveConstValue(const Counter counter)
{
    BOOST_CHECK_EQUAL(counter.get(), 42);
    return counter.get();
}