Skip to content

dsrhaslab/SHARDS-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SHARDS-cpp

This is an implementation of the miss ratio curve online construction technique SHARDS in C++. It is heavily inspired in SHARDS-C, an implementation in C.

Integration with CMake

Using SHARDS as a subdirectory

add_subdirectory(path/to/SHARDS-cpp)
target_link_libraries(your_target PRIVATE shards)

Using an installed SHARDS package

find_package(shards REQUIRED)
target_link_libraries(your_target PRIVATE shards::shards)

Using SHARDS

Include the main header and construct a shards::Shards instance using a ShardsConfig. All interaction with SHARDS is done via non-owning string references (const std::string&).

Example

#include <shards/Shards.h>
#include <shards/ShardsConfig.h>

#include <map>
#include <string>

int main() {
// Configure SHARDS
shards::ShardsConfig config;
// configure fields on `config` as needed

// Create a SHARDS instance
shards::Shards shards(config);

// Notify SHARDS of accesses
std::string key = "object-key";
shards.accessed(key, /* size in bytes */ 4096);

// Use the default object size
shards.accessed(key);

// Remove an object if needed
shards.remove(key);

// Get Miss Ratio Curves (MRCs)
std::map<uint64_t, double> byte_mrc = shards.byteMRC();
std::map<uint64_t, double> object_mrc = shards.objectMRC();

// Reset internal state
shards.clear();

return 0;
}

Notes

The public include path is:

#include <shards/Shards.h>
  • The Shards class lives in the shards namespace

  • String parameters are accepted as const std::string&

    • No ownership is transferred

    • Callers retain full control of their strings

  • Two MRCs are available:

    • byteMRC(): cache size in bytes

    • objectMRC(): cache size in number of objects

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published