Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

A very simple class for counting the number of transitions along IF-ELSE branches.

License

Notifications You must be signed in to change notification settings

yvoinov/expect-stat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Expect Stat

License

Abstract

A very simple class for counting the number of transitions along IF-ELSE branches.

Designed to easily determine which branch prediction hint to put in a hot code. Allows you to simplify this task, reducing the need for thorough testing and benchmarking.

Usage

To use, you need to copy the file in the directory with the desired source code, include the file in the code and put method calls on the corresponding branches. Each transition atomically increases the value of the corresponding counter. Then recompile the program being tested. After completion or interruption of work, the destructor will output the counter values to the output stream. Based on this, you can decide whether to use the hint.

#include "expect_stat.h"	// Include at the module level to instantiate
...

	if (condition) {
		es.if_inc();	// Increment if branch
		...
	} else {
		es.else_inc();	// Increment else branch
		...
	}
...

Notes

Class optimized for any C++11 compliant compiler, tested on GCC, Clang, Oracle Developer Studio.

About

A very simple class for counting the number of transitions along IF-ELSE branches.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages