Clingo
Loading...
Searching...
No Matches

Inspect search and problem stats. More...

Typedefs

typedef int clingo_stats_type_t
 Corresponding type to clingo_stats_type.
 
typedef struct clingo_statistic clingo_stats_t
 Handle for the solver stats.
 

Enumerations

enum  clingo_stats_type_e { clingo_stats_type_value = 0 , clingo_stats_type_array = 1 , clingo_stats_type_map = 2 }
 Enumeration for entries of the stats. More...
 

Functions

CLINGO_VISIBILITY_DEFAULT bool clingo_stats_root (clingo_stats_t const *stats, uint64_t *key)
 Get the root key of the stats.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_stats_type (clingo_stats_t const *stats, uint64_t key, clingo_stats_type_t *type)
 Get the type of a key.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_stats_to_string (clingo_stats_t const *stats, uint64_t key, clingo_string_builder_t *builder)
 Get a string representation of the statistics.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_control_stats (clingo_control_t *control, clingo_stats_t const **stats)
 Get the solver stats.
 

Functions to access arrays

CLINGO_VISIBILITY_DEFAULT bool clingo_stats_array_size (clingo_stats_t const *stats, uint64_t key, size_t *size)
 Get the size of an array entry.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_stats_array_at (clingo_stats_t const *stats, uint64_t key, size_t offset, uint64_t *subkey)
 Get the subkey at the given offset of an array entry.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_stats_array_push (clingo_stats_t *stats, uint64_t key, clingo_stats_type_t type, uint64_t *subkey)
 Create the subkey at the end of an array entry.
 

Functions to access maps

CLINGO_VISIBILITY_DEFAULT bool clingo_stats_map_size (clingo_stats_t const *stats, uint64_t key, size_t *size)
 Get the number of subkeys of a map entry.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_stats_map_has_subkey (clingo_stats_t const *stats, uint64_t key, char const *name, size_t size, bool *result)
 Test if the given map contains a specific subkey.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_stats_map_subkey_name (clingo_stats_t const *stats, uint64_t key, size_t offset, clingo_string_t *name)
 Get the name associated with the offset-th subkey.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_stats_map_at (clingo_stats_t const *stats, uint64_t key, char const *name, size_t size, uint64_t *subkey)
 Lookup a subkey under the given name.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_stats_map_add_subkey (clingo_stats_t *stats, uint64_t key, char const *name, size_t size, clingo_stats_type_t type, uint64_t *subkey)
 Add a subkey with the given name.
 

Functions to inspect and change values

CLINGO_VISIBILITY_DEFAULT bool clingo_stats_value_get (clingo_stats_t const *stats, uint64_t key, double *value)
 Get the value of the given entry.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_stats_value_set (clingo_stats_t *stats, uint64_t key, double value)
 Set the value of the given entry.
 

Detailed Description

Inspect search and problem stats.

For an example, see stats.c.

Enumeration Type Documentation

◆ clingo_stats_type_e

Enumeration for entries of the stats.

Enumerator
clingo_stats_type_value 

the entry is a (double) value

clingo_stats_type_array 

the entry is an array

clingo_stats_type_map 

the entry is a map

Function Documentation

◆ clingo_control_stats()

CLINGO_VISIBILITY_DEFAULT bool clingo_control_stats ( clingo_control_t *  control,
clingo_stats_t const **  stats 
)

Get the solver stats.

Parameters
[in]controlthe target control object
[out]statsthe resulting stats object
Returns
wether the call was successful

◆ clingo_stats_array_at()

CLINGO_VISIBILITY_DEFAULT bool clingo_stats_array_at ( clingo_stats_t const *  stats,
uint64_t  key,
size_t  offset,
uint64_t *  subkey 
)

Get the subkey at the given offset of an array entry.

Precondition
The type of the entry must be clingo_stats_type_array.
Parameters
[in]statsthe target stats
[in]keythe key
[in]offsetthe offset in the array
[out]subkeythe resulting subkey
Returns
wether the call was successful

◆ clingo_stats_array_push()

CLINGO_VISIBILITY_DEFAULT bool clingo_stats_array_push ( clingo_stats_t stats,
uint64_t  key,
clingo_stats_type_t  type,
uint64_t *  subkey 
)

Create the subkey at the end of an array entry.

Precondition
The type of the entry must be clingo_stats_type_array.
Parameters
[in]statsthe target stats
[in]keythe key
[in]typethe type of the new subkey
[out]subkeythe resulting subkey
Returns
wether the call was successful

◆ clingo_stats_array_size()

CLINGO_VISIBILITY_DEFAULT bool clingo_stats_array_size ( clingo_stats_t const *  stats,
uint64_t  key,
size_t *  size 
)

Get the size of an array entry.

Precondition
The type of the entry must be clingo_stats_type_array.
Parameters
[in]statsthe target stats
[in]keythe key
[out]sizethe resulting size
Returns
wether the call was successful

◆ clingo_stats_map_add_subkey()

CLINGO_VISIBILITY_DEFAULT bool clingo_stats_map_add_subkey ( clingo_stats_t stats,
uint64_t  key,
char const *  name,
size_t  size,
clingo_stats_type_t  type,
uint64_t *  subkey 
)

Add a subkey with the given name.

Precondition
The type of the entry must be clingo_stats_type_map.
Parameters
[in]statsthe target stats
[in]keythe key
[in]namethe name of the new subkey
[in]sizethe size of the name
[in]typethe type of the new subkey
[out]subkeythe index of the resulting subkey
Returns
wether the call was successful

◆ clingo_stats_map_at()

CLINGO_VISIBILITY_DEFAULT bool clingo_stats_map_at ( clingo_stats_t const *  stats,
uint64_t  key,
char const *  name,
size_t  size,
uint64_t *  subkey 
)

Lookup a subkey under the given name.

Precondition
The type of the entry must be clingo_stats_type_map.
Note
Multiple levels can be looked up by concatenating keys with a period.
Parameters
[in]statsthe target stats
[in]keythe key
[in]namethe name to look up the subkey
[in]sizethe size of the name
[out]subkeythe resulting subkey
Returns
wether the call was successful

◆ clingo_stats_map_has_subkey()

CLINGO_VISIBILITY_DEFAULT bool clingo_stats_map_has_subkey ( clingo_stats_t const *  stats,
uint64_t  key,
char const *  name,
size_t  size,
bool *  result 
)

Test if the given map contains a specific subkey.

Precondition
The type of the entry must be clingo_stats_type_map.
Parameters
[in]statsthe target stats
[in]keythe key
[in]namename of the subkey
[in]sizethe size of the name
[out]resulttrue if the map has a subkey with the given name
Returns
wether the call was successful

◆ clingo_stats_map_size()

CLINGO_VISIBILITY_DEFAULT bool clingo_stats_map_size ( clingo_stats_t const *  stats,
uint64_t  key,
size_t *  size 
)

Get the number of subkeys of a map entry.

Precondition
The type of the entry must be clingo_stats_type_map.
Parameters
[in]statsthe target stats
[in]keythe key
[out]sizethe resulting number
Returns
wether the call was successful

◆ clingo_stats_map_subkey_name()

CLINGO_VISIBILITY_DEFAULT bool clingo_stats_map_subkey_name ( clingo_stats_t const *  stats,
uint64_t  key,
size_t  offset,
clingo_string_t name 
)

Get the name associated with the offset-th subkey.

Precondition
The type of the entry must be clingo_stats_type_map.
Parameters
[in]statsthe target stats
[in]keythe key
[in]offsetthe offset of the name
[out]namethe resulting name
Returns
wether the call was successful

◆ clingo_stats_root()

CLINGO_VISIBILITY_DEFAULT bool clingo_stats_root ( clingo_stats_t const *  stats,
uint64_t *  key 
)

Get the root key of the stats.

Parameters
[in]statsthe target stats
[out]keythe root key
Returns
wether the call was successful

◆ clingo_stats_to_string()

CLINGO_VISIBILITY_DEFAULT bool clingo_stats_to_string ( clingo_stats_t const *  stats,
uint64_t  key,
clingo_string_builder_t builder 
)

Get a string representation of the statistics.

The representation is in a YAML-like format.

Parameters
statsthe stats
keythe key
builderthe builder
Returns
whether the call was successful

◆ clingo_stats_type()

CLINGO_VISIBILITY_DEFAULT bool clingo_stats_type ( clingo_stats_t const *  stats,
uint64_t  key,
clingo_stats_type_t type 
)

Get the type of a key.

Parameters
[in]statsthe target stats
[in]keythe key
[out]typethe resulting type
Returns
wether the call was successful

◆ clingo_stats_value_get()

CLINGO_VISIBILITY_DEFAULT bool clingo_stats_value_get ( clingo_stats_t const *  stats,
uint64_t  key,
double *  value 
)

Get the value of the given entry.

Precondition
The type of the entry must be clingo_stats_type_value.
Parameters
[in]statsthe target stats
[in]keythe key
[out]valuethe resulting value
Returns
wether the call was successful

◆ clingo_stats_value_set()

CLINGO_VISIBILITY_DEFAULT bool clingo_stats_value_set ( clingo_stats_t stats,
uint64_t  key,
double  value 
)

Set the value of the given entry.

Precondition
The type of the entry must be clingo_stats_type_value.
Parameters
[in]statsthe target stats
[in]keythe key
[out]valuethe new value
Returns
wether the call was successful