OmniSketch  0.1
Oh my sketch!
OmniSketch::Test::CountSketchTest< key_len, T, hash_t > Class Template Reference

Testing class for Count Sketch. More...

#include <CountSketchTest.h>

Inheritance diagram for OmniSketch::Test::CountSketchTest< key_len, T, hash_t >:

Public Member Functions

 CountSketchTest (const std::string_view config_file)
 Constructor. More...
 
void runTest () override
 Test Bloom Filter. More...
 
- Public Member Functions inherited from OmniSketch::Test::TestBase< key_len, T >
 TestBase (const std::string_view show_name, const std::string_view config_file, const std::string_view test_path)
 Construct by specifying all necessary tables in config file. More...
 
virtual void show () const final
 Display metrics in a human-readable manner. More...
 
virtual void testSize (std::unique_ptr< Sketch::SketchBase< key_len, T >> &ptr_sketch) final
 Get the size of the sketch. More...
 
virtual void testInsert (std::unique_ptr< Sketch::SketchBase< key_len, T >> &ptr_sketch, typename std::vector< Data::Record< key_len >>::const_iterator begin, typename std::vector< Data::Record< key_len >>::const_iterator end) final
 Insert a row of records. More...
 
virtual void testUpdate (std::unique_ptr< Sketch::SketchBase< key_len, T >> &ptr_sketch, typename std::vector< Data::Record< key_len >>::const_iterator begin, typename std::vector< Data::Record< key_len >>::const_iterator end, Data::CntMethod cnt_method) final
 Update a row of records (with values to the sketch) More...
 
virtual void testQuery (std::unique_ptr< Sketch::SketchBase< key_len, T >> &ptr_sketch, const Data::GndTruth< key_len, T > &gnd_truth) final
 Query for each flow in ground truth. More...
 
virtual void testLookup (std::unique_ptr< Sketch::SketchBase< key_len, T >> &ptr_sketch, const Data::GndTruth< key_len, T > &gnd_truth, const Data::GndTruth< key_len, T > &sample) final
 Lookup each flow in ground truth. More...
 
virtual void testHeavyHitter (std::unique_ptr< Sketch::SketchBase< key_len, T >> &ptr_sketch, double threshold, Data::GndTruth< key_len, T > gnd_truth_heavy_hitters) final
 Test heavy hitters. More...
 
virtual void testHeavyChanger (std::unique_ptr< Sketch::SketchBase< key_len, T >> &ptr_sketch_1, std::unique_ptr< Sketch::SketchBase< key_len, T >> &ptr_sketch_2, double threshold, Data::GndTruth< key_len, T > gnd_truth_heavy_changers) final
 Test heavy changers. More...
 
virtual void testDecode (std::unique_ptr< Sketch::SketchBase< key_len, T >> &ptr_sketch, Data::GndTruth< key_len, T > gnd_truth) final
 Test decode. More...
 

Additional Inherited Members

- Protected Attributes inherited from OmniSketch::Test::TestBase< key_len, T >
const std::string_view show_name
 
const std::string_view config_file
 
const std::string_view test_path
 

Detailed Description

template<int32_t key_len, typename T, typename hash_t = Hash::AwareHash>
class OmniSketch::Test::CountSketchTest< key_len, T, hash_t >

Testing class for Count Sketch.

Constructor & Destructor Documentation

◆ CountSketchTest()

template<int32_t key_len, typename T , typename hash_t = Hash::AwareHash>
OmniSketch::Test::CountSketchTest< key_len, T, hash_t >::CountSketchTest ( const std::string_view  config_file)
inline

Constructor.

Names from left to right are

  • show name
  • config file
  • path to the node that contains metrics of interest (concatenated with '.')

Member Function Documentation

◆ runTest()

template<int32_t key_len, typename T , typename hash_t >
void OmniSketch::Test::CountSketchTest< key_len, T, hash_t >::runTest
overridevirtual

Test Bloom Filter.

An overriden method

shorthand for convenience

Part I. Parse the config file

Step i. First we list the variables to parse, namely:

Step ii. Open the config file

Step iii. Set the working node of the parser.

Step iv. Parse num_bits and num_hash

Step v. Move to the data node

Step vi. Parse data and format

[Optional] User-defined rules

Step vii. Parse Cnt Method.

Part II. Prepare sketch and data

Step i. Initialize a sketch

remember that the left ptr must point to the base class in order to call the methods in it

Step ii. Get ground truth

  1. read data 
  1. [optional] show data info

Step iii. Insert the samples and then look up all the flows

   1. update records into the sketch 
  1. query for all the flowkeys
  2. size
  1. show metrics

Reimplemented from OmniSketch::Test::TestBase< key_len, T >.