OpenCog Framework  Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
opencog::AtomSpaceBenchmark Class Reference

#include <AtomSpaceBenchmark.h>

+ Collaboration diagram for opencog::AtomSpaceBenchmark:

Classes

struct  TimeStats
 

Public Types

enum  BenchType { BENCH_AS = 1, BENCH_TABLE, BENCH_SCM, BENCH_PYTHON }
 
typedef timepair_t(AtomSpaceBenchmark::* BMFn )()
 

Public Member Functions

void printTypeSizes ()
 
size_t estimateOfAtomSize (Handle h)
 
 AtomSpaceBenchmark ()
 
 ~AtomSpaceBenchmark ()
 
void setMethod (std::string method)
 
void showMethods ()
 
void startBenchmark (int numThreads=1)
 
void doBenchmark (const std::string &methodName, BMFn methodToCall)
 
void buildAtomSpace (long atomspaceSize=(1<< 16), float percentLinks=0.1, bool display=true)
 
Handle getRandomHandle ()
 
void setTestAllMethods ()
 
timepair_t bm_noop ()
 
timepair_t bm_addNode ()
 
timepair_t bm_addLink ()
 
timepair_t bm_rmAtom ()
 
timepair_t bm_getType ()
 
timepair_t bm_getHandlesByType ()
 
timepair_t bm_getOutgoingSet ()
 
timepair_t bm_getIncomingSet ()
 
timepair_t bm_getTruthValue ()
 
timepair_t bm_setTruthValue ()
 

Public Attributes

unsigned int Nreps
 
unsigned int Nloops
 
bool memoize
 
bool compile
 
int sizeIncrease
 
bool saveToFile
 
int saveInterval
 
bool doStats
 
bool buildTestData
 
unsigned long randomseed
 
BenchType testKind
 
UUID UUID_begin
 
UUID UUID_end
 
std::vector< BMFnmethodsToTest
 
float percentLinks
 
long atomCount
 
bool showTypeSizes
 number of nodes to build atomspace with before testing More...
 
float chanceUseDefaultTV
 

Private Types

typedef boost::tuple< size_t,
clock_t, long > 
record_t
 

Private Member Functions

void recordToFile (std::ofstream &file, const record_t record) const
 
Type randomType (Type t)
 
clock_t makeRandomNode (const std::string &s)
 
clock_t makeRandomLink ()
 
long getMemUsage ()
 
std::string memoize_or_compile (std::string)
 

Private Attributes

float linkSize_mean
 
Type defaultLinkType
 
float chanceOfNonDefaultLink
 
Type defaultNodeType
 
float chanceOfNonDefaultNode
 
float maxSize
 
AtomSpaceasp
 never make the atomspace bigger than this while building it More...
 
AtomTableatab
 
SchemeEvalscm
 
PythonEvalpyev
 
MT19937RandGen * rng
 
std::default_random_engine randgen
 
std::poisson_distribution
< unsigned > * 
prg
 
Type numberOfTypes
 
int counter
 
std::vector< std::string > methodNames
 

Detailed Description

Definition at line 24 of file AtomSpaceBenchmark.h.

Member Typedef Documentation

typedef timepair_t(AtomSpaceBenchmark::* opencog::AtomSpaceBenchmark::BMFn)()

Definition at line 104 of file AtomSpaceBenchmark.h.

typedef boost::tuple<size_t,clock_t,long> opencog::AtomSpaceBenchmark::record_t
private

Definition at line 27 of file AtomSpaceBenchmark.h.

Member Enumeration Documentation

Enumerator
BENCH_AS 
BENCH_TABLE 
BENCH_SCM 
BENCH_PYTHON 

Definition at line 92 of file AtomSpaceBenchmark.h.

Constructor & Destructor Documentation

opencog::AtomSpaceBenchmark::AtomSpaceBenchmark ( )

Definition at line 42 of file AtomSpaceBenchmark.cc.

opencog::AtomSpaceBenchmark::~AtomSpaceBenchmark ( )

Definition at line 79 of file AtomSpaceBenchmark.cc.

Member Function Documentation

timepair_t opencog::AtomSpaceBenchmark::bm_addLink ( )

Definition at line 770 of file AtomSpaceBenchmark.cc.

+ Here is the caller graph for this function:

timepair_t opencog::AtomSpaceBenchmark::bm_addNode ( )

Definition at line 764 of file AtomSpaceBenchmark.cc.

+ Here is the caller graph for this function:

timepair_t opencog::AtomSpaceBenchmark::bm_getHandlesByType ( )

Definition at line 1019 of file AtomSpaceBenchmark.cc.

References python.undocumented.blocksworld::t.

+ Here is the caller graph for this function:

timepair_t opencog::AtomSpaceBenchmark::bm_getIncomingSet ( )

Definition at line 1105 of file AtomSpaceBenchmark.cc.

References opencog::Atom::getIncomingSet(), and opencog::Handle::value().

+ Here is the caller graph for this function:

timepair_t opencog::AtomSpaceBenchmark::bm_getOutgoingSet ( )

Definition at line 1057 of file AtomSpaceBenchmark.cc.

References opencog::Handle::value().

+ Here is the caller graph for this function:

timepair_t opencog::AtomSpaceBenchmark::bm_getTruthValue ( )

Definition at line 903 of file AtomSpaceBenchmark.cc.

References opencog::Atom::getTruthValue(), and opencog::Handle::value().

+ Here is the caller graph for this function:

timepair_t opencog::AtomSpaceBenchmark::bm_getType ( )

Definition at line 853 of file AtomSpaceBenchmark.cc.

References opencog::Atom::getType(), and opencog::Handle::value().

+ Here is the caller graph for this function:

timepair_t opencog::AtomSpaceBenchmark::bm_noop ( )

Definition at line 754 of file AtomSpaceBenchmark.cc.

+ Here is the caller graph for this function:

timepair_t opencog::AtomSpaceBenchmark::bm_rmAtom ( )

Definition at line 776 of file AtomSpaceBenchmark.cc.

References opencog::Atom::getIncomingSetSize(), and opencog::Handle::value().

+ Here is the caller graph for this function:

timepair_t opencog::AtomSpaceBenchmark::bm_setTruthValue ( )

Definition at line 960 of file AtomSpaceBenchmark.cc.

References opencog::SimpleTruthValue::createTV(), opencog::Atom::setTruthValue(), and opencog::Handle::value().

+ Here is the caller graph for this function:

void opencog::AtomSpaceBenchmark::buildAtomSpace ( long  atomspaceSize = (1 << 16),
float  percentLinks = 0.1,
bool  display = true 
)
void opencog::AtomSpaceBenchmark::doBenchmark ( const std::string &  methodName,
BMFn  methodToCall 
)
long opencog::AtomSpaceBenchmark::getMemUsage ( )
private

Definition at line 133 of file AtomSpaceBenchmark.cc.

Handle opencog::AtomSpaceBenchmark::getRandomHandle ( )

Definition at line 842 of file AtomSpaceBenchmark.cc.

clock_t opencog::AtomSpaceBenchmark::makeRandomLink ( )
private
clock_t opencog::AtomSpaceBenchmark::makeRandomNode ( const std::string &  s)
private
std::string opencog::AtomSpaceBenchmark::memoize_or_compile ( std::string  exp)
private

Definition at line 451 of file AtomSpaceBenchmark.cc.

void opencog::AtomSpaceBenchmark::printTypeSizes ( )

Definition at line 144 of file AtomSpaceBenchmark.cc.

References createLink, DIVIDER_LINE, LK, and ND.

Type opencog::AtomSpaceBenchmark::randomType ( Type  t)
private

Definition at line 483 of file AtomSpaceBenchmark.cc.

References opencog::classserver().

void opencog::AtomSpaceBenchmark::recordToFile ( std::ofstream &  file,
const record_t  record 
) const
private

Definition at line 1184 of file AtomSpaceBenchmark.cc.

void opencog::AtomSpaceBenchmark::setMethod ( std::string  method)
void opencog::AtomSpaceBenchmark::setTestAllMethods ( )
inline

Definition at line 125 of file AtomSpaceBenchmark.h.

References setMethod().

+ Here is the caller graph for this function:

void opencog::AtomSpaceBenchmark::showMethods ( )
Todo:
should really encapsulate each test method in a struct or class

Definition at line 191 of file AtomSpaceBenchmark.cc.

+ Here is the caller graph for this function:

void opencog::AtomSpaceBenchmark::startBenchmark ( int  numThreads = 1)

Member Data Documentation

AtomSpace* opencog::AtomSpaceBenchmark::asp
private

never make the atomspace bigger than this while building it

Definition at line 53 of file AtomSpaceBenchmark.h.

AtomTable* opencog::AtomSpaceBenchmark::atab
private

Definition at line 54 of file AtomSpaceBenchmark.h.

long opencog::AtomSpaceBenchmark::atomCount

Definition at line 108 of file AtomSpaceBenchmark.h.

bool opencog::AtomSpaceBenchmark::buildTestData

Definition at line 89 of file AtomSpaceBenchmark.h.

float opencog::AtomSpaceBenchmark::chanceOfNonDefaultLink
private

Definition at line 47 of file AtomSpaceBenchmark.h.

float opencog::AtomSpaceBenchmark::chanceOfNonDefaultNode
private

Definition at line 49 of file AtomSpaceBenchmark.h.

float opencog::AtomSpaceBenchmark::chanceUseDefaultTV

Definition at line 138 of file AtomSpaceBenchmark.h.

bool opencog::AtomSpaceBenchmark::compile

Definition at line 84 of file AtomSpaceBenchmark.h.

int opencog::AtomSpaceBenchmark::counter
private

Definition at line 74 of file AtomSpaceBenchmark.h.

Type opencog::AtomSpaceBenchmark::defaultLinkType
private

Definition at line 46 of file AtomSpaceBenchmark.h.

Type opencog::AtomSpaceBenchmark::defaultNodeType
private

Definition at line 48 of file AtomSpaceBenchmark.h.

bool opencog::AtomSpaceBenchmark::doStats

Definition at line 88 of file AtomSpaceBenchmark.h.

float opencog::AtomSpaceBenchmark::linkSize_mean
private

Definition at line 44 of file AtomSpaceBenchmark.h.

float opencog::AtomSpaceBenchmark::maxSize
private

Definition at line 51 of file AtomSpaceBenchmark.h.

bool opencog::AtomSpaceBenchmark::memoize

Definition at line 83 of file AtomSpaceBenchmark.h.

std::vector<std::string> opencog::AtomSpaceBenchmark::methodNames
private

Definition at line 78 of file AtomSpaceBenchmark.h.

std::vector< BMFn > opencog::AtomSpaceBenchmark::methodsToTest

Definition at line 105 of file AtomSpaceBenchmark.h.

unsigned int opencog::AtomSpaceBenchmark::Nloops

Definition at line 82 of file AtomSpaceBenchmark.h.

unsigned int opencog::AtomSpaceBenchmark::Nreps

Definition at line 81 of file AtomSpaceBenchmark.h.

Type opencog::AtomSpaceBenchmark::numberOfTypes
private

Definition at line 68 of file AtomSpaceBenchmark.h.

float opencog::AtomSpaceBenchmark::percentLinks

Definition at line 107 of file AtomSpaceBenchmark.h.

std::poisson_distribution<unsigned>* opencog::AtomSpaceBenchmark::prg
private

Definition at line 65 of file AtomSpaceBenchmark.h.

PythonEval* opencog::AtomSpaceBenchmark::pyev
private

Definition at line 59 of file AtomSpaceBenchmark.h.

std::default_random_engine opencog::AtomSpaceBenchmark::randgen
private

Definition at line 64 of file AtomSpaceBenchmark.h.

unsigned long opencog::AtomSpaceBenchmark::randomseed

Definition at line 90 of file AtomSpaceBenchmark.h.

MT19937RandGen* opencog::AtomSpaceBenchmark::rng
private

Definition at line 62 of file AtomSpaceBenchmark.h.

int opencog::AtomSpaceBenchmark::saveInterval

Definition at line 87 of file AtomSpaceBenchmark.h.

bool opencog::AtomSpaceBenchmark::saveToFile

Definition at line 86 of file AtomSpaceBenchmark.h.

SchemeEval* opencog::AtomSpaceBenchmark::scm
private

Definition at line 56 of file AtomSpaceBenchmark.h.

bool opencog::AtomSpaceBenchmark::showTypeSizes

number of nodes to build atomspace with before testing

Definition at line 110 of file AtomSpaceBenchmark.h.

int opencog::AtomSpaceBenchmark::sizeIncrease

Definition at line 85 of file AtomSpaceBenchmark.h.

BenchType opencog::AtomSpaceBenchmark::testKind

Definition at line 100 of file AtomSpaceBenchmark.h.

UUID opencog::AtomSpaceBenchmark::UUID_begin

Definition at line 102 of file AtomSpaceBenchmark.h.

UUID opencog::AtomSpaceBenchmark::UUID_end

Definition at line 103 of file AtomSpaceBenchmark.h.


The documentation for this class was generated from the following files: