diff --git a/example/cacheCluster/CMakeLists.txt b/example/cacheCluster/CMakeLists.txt index 40d6c36f..3bf99e2d 100644 --- a/example/cacheCluster/CMakeLists.txt +++ b/example/cacheCluster/CMakeLists.txt @@ -1,29 +1,29 @@ cmake_minimum_required (VERSION 3.2) project (cacheCluster) -set(CMAKE_BUILD_TYPE Debug) -set(CMAKE_CXX_STANDARD 11) +# set(CMAKE_BUILD_TYPE Debug) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -# clear an error when using cmake in macOS -# if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") -# set(CMAKE_MACOSX_RPATH 1) -# # Fix linking on 10.14+. See https://stackoverflow.com/questions/54068035 -# LINK_DIRECTORIES(/usr/local/lib) -# # a temporary fix for mac -# SET(CMAKE_C_FLAGS_DEBUG " -L/usr/local/lib -lglib-2.0 -lintl -Wno-unused-command-line-argument") -# endif() - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../../cmake/Modules/") find_package(GLib "2.40" REQUIRED) include_directories(${GLib_INCLUDE_DIRS}) message(STATUS "glib found? " ${GLib_FOUND} ", GLIB = " ${GLib_LIBRARY} ", header = " ${GLib_INCLUDE_DIRS}) + +find_package(ZSTD) +# https://stackoverflow.com/questions/61377055/cannot-find-gflags-gflags-h-while-building-library-osx/61379123#61379123 +include_directories(${ZSTD_INCLUDE_DIR}) +if ("${ZSTD_LIBRARIES}" STREQUAL "") + message(FATAL_ERROR "zstd not found") +endif() + + ################ this mode compiles the external cache replacement algorithm together with the simulator ############ message(STATUS "project_source dir = " ${PROJECT_SOURCE_DIR}) file(GLOB ALL_CXX_SRC ${PROJECT_SOURCE_DIR}/*.cpp) file(GLOB ALL_C_SRC ${PROJECT_SOURCE_DIR}/*.c) add_executable(cacheCluster ${ALL_CXX_SRC} ${ALL_C_SRC}) -target_link_libraries(cacheCluster libCacheSim m ${GLib_LIBRARY} pthread dl) +target_link_libraries(cacheCluster libCacheSim m ${GLib_LIBRARY} pthread dl ${ZSTD_LIBRARIES}) diff --git a/example/cacheCluster/main.cpp b/example/cacheCluster/main.cpp index 008d2882..747e1ac7 100644 --- a/example/cacheCluster/main.cpp +++ b/example/cacheCluster/main.cpp @@ -13,9 +13,11 @@ namespace CDNSimulator { void simulate(int argc, char *argv[]) { - const char *data_path = "../../../data/trace.csv"; + const char *data_path = "../../../data/twitter_cluster52.csv"; if (argc > 1) { data_path = argv[1]; + } else { + printf("use default data at ../../../data/twitter_cluster52.csv\n"); } if (access(data_path, F_OK) == -1) { @@ -25,9 +27,9 @@ void simulate(int argc, char *argv[]) { /* setup a csv reader */ reader_init_param_t init_params = default_reader_init_params(); - init_params.obj_id_field = 5; - init_params.obj_size_field = 4; - init_params.time_field = 2; + init_params.obj_id_field = 2; + init_params.obj_size_field = 3; + init_params.time_field = 1; init_params.has_header_set = true; init_params.has_header = true; init_params.delimiter = ','; @@ -36,12 +38,17 @@ void simulate(int argc, char *argv[]) { reader_t *reader = open_trace(data_path, CSV_TRACE, &init_params); const uint64_t n_server = 10; - const uint64_t server_dram_cache_size = 8 * GiB; - const uint64_t server_disk_cache_size = 100 * GiB; + const uint64_t server_dram_cache_size = 1 * MiB; + const uint64_t server_disk_cache_size = 10 * MiB; const std::string algo = "lru"; // each cache holds 2 ** 20 objects, this is for performance optimization // you can specify a smaller number to save memory const uint32_t hashpower = 20; + printf( + "setting up a cluster of %lu servers, each server has %lu MB DRAM cache " + "and %lu MB disk cache, using %s as cache replacement algorithm\n", + (unsigned long)n_server, (unsigned long)(server_dram_cache_size / MiB), + (unsigned long)(server_disk_cache_size / MiB), algo.c_str()); CacheCluster cluster(0); @@ -68,10 +75,8 @@ void simulate(int argc, char *argv[]) { n_req_byte += req->obj_size; } - std::cout << n_req << " requests, " << n_miss - << " misses, miss ratio: " << (double)n_miss / n_req - << ", byte miss ratio: " << (double)n_miss_byte / n_req_byte - << std::endl; + std::cout << n_req << " requests, " << n_miss << " misses, miss ratio: " << (double)n_miss / n_req + << ", byte miss ratio: " << (double)n_miss_byte / n_req_byte << std::endl; close_trace(reader); } diff --git a/example/cacheHierarchy/CMakeLists.txt b/example/cacheHierarchy/CMakeLists.txt index cb4fa113..19a62c31 100644 --- a/example/cacheHierarchy/CMakeLists.txt +++ b/example/cacheHierarchy/CMakeLists.txt @@ -1,33 +1,28 @@ cmake_minimum_required (VERSION 3.2) project (layeredCache) - -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) message("****************** this example only works after libCacheSim has been installed ******************") -#### -## export C_INCLUDE_PATH=/usr/local/include -## export CPLUS_INCLUDE_PATH=/usr/local/include - -# clear an error when using cmake in macOS -if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set(CMAKE_MACOSX_RPATH 1) - # Fix linking on 10.14+. See https://stackoverflow.com/questions/54068035 - LINK_DIRECTORIES(/usr/local/lib) - # a temporary fix for mac - SET(CMAKE_C_FLAGS_DEBUG " -L/usr/local/lib -lglib-2.0 -lintl -Wno-unused-command-line-argument") -endif() - - -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") -# find libglib2.0-dev +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../../cmake/Modules/") find_package(GLib "2.40" REQUIRED) include_directories(${GLib_INCLUDE_DIRS}) message(STATUS "glib found? " ${GLib_FOUND} ", GLIB = " ${GLib_LIBRARY} ", header = " ${GLib_INCLUDE_DIRS}) -# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "/usr/local/share/cmake/yaml-cpp/") +find_package(ZSTD) +include_directories(${ZSTD_INCLUDE_DIR}) +if ("${ZSTD_LIBRARIES}" STREQUAL "") + message(FATAL_ERROR "zstd not found") +endif() + + +# https://github.com/jbeder/yaml-cpp +# wget https://github.com/jbeder/yaml-cpp/archive/refs/tags/0.8.0.tar.gz +# tar -xzf 0.8.0.tar.gz; mkdir yaml-cpp-0.8.0/_build; cd yaml-cpp-0.8.0/_build; +# cmake -DBUILD_SHARED_LIBS=ON ..; +# make -j; sudo make install find_package(YAML-CPP REQUIRED) # set(YAML_CPP_INCLUDE_DIR /usr/local/include/) # set(YAML_CPP_LIBRARIES /usr/local/lib/) @@ -38,10 +33,5 @@ message(STATUS ${YAML_CPP_INCLUDE_DIR} ";" ${YAML_CPP_LIBRARIES}) file(GLOB ALL_SRC ${PROJECT_SOURCE_DIR}/*.cpp) message(STATUS "all sources " ${ALL_SRC}) add_executable(layeredCache ${ALL_SRC}) -target_link_libraries(layeredCache yaml-cpp libCacheSim m ${GLib_LIBRARY}) - - - - - +target_link_libraries(layeredCache yaml-cpp libCacheSim dl m ${GLib_LIBRARY} ${ZSTD_LIBRARIES} pthread) diff --git a/example/cacheHierarchy/cmake/Modules/FindGLib.cmake b/example/cacheHierarchy/cmake/Modules/FindGLib.cmake deleted file mode 100644 index 8939d857..00000000 --- a/example/cacheHierarchy/cmake/Modules/FindGLib.cmake +++ /dev/null @@ -1,83 +0,0 @@ -# FindGLib.cmake -# -# -# CMake support for GLib/GObject/GIO. -# -# License: -# -# Copyright (c) 2016 Evan Nemerson -# -# Permission is hereby granted, free of charge, to any person -# obtaining a copy of this software and associated documentation -# files (the "Software"), to deal in the Software without -# restriction, including without limitation the rights to use, copy, -# modify, merge, publish, distribute, sublicense, and/or sell copies -# of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -find_package(PkgConfig) - -if(PKG_CONFIG_FOUND) - pkg_search_module(GLib_PKG glib-2.0) -endif() - -find_library(GLib_LIBRARY glib-2.0 HINTS ${GLib_PKG_LIBRARY_DIRS}) -set(GLib glib-2.0) - -if(GLib_LIBRARY AND NOT GLib_FOUND) - add_library(${GLib} SHARED IMPORTED) - set_property(TARGET ${GLib} PROPERTY IMPORTED_LOCATION "${GLib_LIBRARY}") - set_property(TARGET ${GLib} PROPERTY INTERFACE_COMPILE_OPTIONS "${GLib_PKG_CFLAGS_OTHER}") - - find_path(GLib_INCLUDE_DIRS "glib.h" - HINTS ${GLib_PKG_INCLUDE_DIRS} - PATH_SUFFIXES "glib-2.0") - - get_filename_component(GLib_LIBDIR "${GLib}" DIRECTORY) - find_path(GLib_CONFIG_INCLUDE_DIR "glibconfig.h" - HINTS - ${GLib_LIBDIR} - ${GLib_PKG_INCLUDE_DIRS} - PATHS - "${CMAKE_LIBRARY_PATH}" - PATH_SUFFIXES - "glib-2.0/include" - "glib-2.0") - unset(GLib_LIBDIR) - - if(GLib_CONFIG_INCLUDE_DIR) - file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MAJOR_VERSION REGEX "^#define GLIB_MAJOR_VERSION +([0-9]+)") - string(REGEX REPLACE "^#define GLIB_MAJOR_VERSION ([0-9]+)$" "\\1" GLib_MAJOR_VERSION "${GLib_MAJOR_VERSION}") - file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MINOR_VERSION REGEX "^#define GLIB_MINOR_VERSION +([0-9]+)") - string(REGEX REPLACE "^#define GLIB_MINOR_VERSION ([0-9]+)$" "\\1" GLib_MINOR_VERSION "${GLib_MINOR_VERSION}") - file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MICRO_VERSION REGEX "^#define GLIB_MICRO_VERSION +([0-9]+)") - string(REGEX REPLACE "^#define GLIB_MICRO_VERSION ([0-9]+)$" "\\1" GLib_MICRO_VERSION "${GLib_MICRO_VERSION}") - set(GLib_VERSION "${GLib_MAJOR_VERSION}.${GLib_MINOR_VERSION}.${GLib_MICRO_VERSION}") - unset(GLib_MAJOR_VERSION) - unset(GLib_MINOR_VERSION) - unset(GLib_MICRO_VERSION) - - list(APPEND GLib_INCLUDE_DIRS ${GLib_CONFIG_INCLUDE_DIR}) - set_property(TARGET ${GLib} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GLib_INCLUDE_DIRS}") - endif() -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(GLib - REQUIRED_VARS - GLib_LIBRARY - GLib_INCLUDE_DIRS - VERSION_VAR - GLib_VERSION) diff --git a/example/cacheSimulator/CMakeLists.txt b/example/cacheSimulator/CMakeLists.txt index 49775ead..fbf63fcb 100644 --- a/example/cacheSimulator/CMakeLists.txt +++ b/example/cacheSimulator/CMakeLists.txt @@ -4,27 +4,23 @@ project (cacheSimulator) message("****************** this example only works after libCacheSim has been installed ******************") - -# clear an error when using cmake in macOS -# if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") -# set(CMAKE_MACOSX_RPATH 1) -# # Fix linking on 10.14+. See https://stackoverflow.com/questions/54068035 -# LINK_DIRECTORIES(/usr/local/lib) -# # a temporary fix for mac -# SET(CMAKE_C_FLAGS_DEBUG " -L/usr/local/lib -lglib-2.0 -lintl -Wno-unused-command-line-argument") -# endif() - find_library(libCacheSim libCacheSim) find_path(libCacheSimInclude libCacheSim) message(STATUS "libCacheSim found? ${libCacheSim} ${libCacheSimInclude}") include_directories(${libCacheSimInclude}) - -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../../cmake/Modules/") find_package(GLib "2.40" REQUIRED) include_directories(${GLib_INCLUDE_DIRS}) message(STATUS "glib found? ${GLib_FOUND}, lib = ${GLib_LIBRARY}, header = ${GLib_INCLUDE_DIRS}") +find_package(ZSTD) +# https://stackoverflow.com/questions/61377055/cannot-find-gflags-gflags-h-while-building-library-osx/61379123#61379123 +include_directories(${ZSTD_INCLUDE_DIR}) +if ("${ZSTD_LIBRARIES}" STREQUAL "") + message(FATAL_ERROR "zstd not found") +endif() + add_executable(cacheSimulator main.c) -target_link_libraries(cacheSimulator libCacheSim m ${GLib_LIBRARY}) +target_link_libraries(cacheSimulator libCacheSim m ${GLib_LIBRARY} ${ZSTD_LIBRARIES}) diff --git a/example/cacheSimulator/cmake/Modules/FindGLib.cmake b/example/cacheSimulator/cmake/Modules/FindGLib.cmake deleted file mode 100644 index 8939d857..00000000 --- a/example/cacheSimulator/cmake/Modules/FindGLib.cmake +++ /dev/null @@ -1,83 +0,0 @@ -# FindGLib.cmake -# -# -# CMake support for GLib/GObject/GIO. -# -# License: -# -# Copyright (c) 2016 Evan Nemerson -# -# Permission is hereby granted, free of charge, to any person -# obtaining a copy of this software and associated documentation -# files (the "Software"), to deal in the Software without -# restriction, including without limitation the rights to use, copy, -# modify, merge, publish, distribute, sublicense, and/or sell copies -# of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -find_package(PkgConfig) - -if(PKG_CONFIG_FOUND) - pkg_search_module(GLib_PKG glib-2.0) -endif() - -find_library(GLib_LIBRARY glib-2.0 HINTS ${GLib_PKG_LIBRARY_DIRS}) -set(GLib glib-2.0) - -if(GLib_LIBRARY AND NOT GLib_FOUND) - add_library(${GLib} SHARED IMPORTED) - set_property(TARGET ${GLib} PROPERTY IMPORTED_LOCATION "${GLib_LIBRARY}") - set_property(TARGET ${GLib} PROPERTY INTERFACE_COMPILE_OPTIONS "${GLib_PKG_CFLAGS_OTHER}") - - find_path(GLib_INCLUDE_DIRS "glib.h" - HINTS ${GLib_PKG_INCLUDE_DIRS} - PATH_SUFFIXES "glib-2.0") - - get_filename_component(GLib_LIBDIR "${GLib}" DIRECTORY) - find_path(GLib_CONFIG_INCLUDE_DIR "glibconfig.h" - HINTS - ${GLib_LIBDIR} - ${GLib_PKG_INCLUDE_DIRS} - PATHS - "${CMAKE_LIBRARY_PATH}" - PATH_SUFFIXES - "glib-2.0/include" - "glib-2.0") - unset(GLib_LIBDIR) - - if(GLib_CONFIG_INCLUDE_DIR) - file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MAJOR_VERSION REGEX "^#define GLIB_MAJOR_VERSION +([0-9]+)") - string(REGEX REPLACE "^#define GLIB_MAJOR_VERSION ([0-9]+)$" "\\1" GLib_MAJOR_VERSION "${GLib_MAJOR_VERSION}") - file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MINOR_VERSION REGEX "^#define GLIB_MINOR_VERSION +([0-9]+)") - string(REGEX REPLACE "^#define GLIB_MINOR_VERSION ([0-9]+)$" "\\1" GLib_MINOR_VERSION "${GLib_MINOR_VERSION}") - file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MICRO_VERSION REGEX "^#define GLIB_MICRO_VERSION +([0-9]+)") - string(REGEX REPLACE "^#define GLIB_MICRO_VERSION ([0-9]+)$" "\\1" GLib_MICRO_VERSION "${GLib_MICRO_VERSION}") - set(GLib_VERSION "${GLib_MAJOR_VERSION}.${GLib_MINOR_VERSION}.${GLib_MICRO_VERSION}") - unset(GLib_MAJOR_VERSION) - unset(GLib_MINOR_VERSION) - unset(GLib_MICRO_VERSION) - - list(APPEND GLib_INCLUDE_DIRS ${GLib_CONFIG_INCLUDE_DIR}) - set_property(TARGET ${GLib} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GLib_INCLUDE_DIRS}") - endif() -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(GLib - REQUIRED_VARS - GLib_LIBRARY - GLib_INCLUDE_DIRS - VERSION_VAR - GLib_VERSION) diff --git a/example/cacheSimulatorConcurrent/CMakeLists.txt b/example/cacheSimulatorConcurrent/CMakeLists.txt index d5f60a93..1494124d 100644 --- a/example/cacheSimulatorConcurrent/CMakeLists.txt +++ b/example/cacheSimulatorConcurrent/CMakeLists.txt @@ -1,18 +1,27 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 3.2) project (cacheSimulatorMultiSize) -# set(CMAKE_BUILD_TYPE Debug) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") find_library(libCacheSim libCacheSim) find_path(libCacheSimInclude libCacheSim) include_directories(${libCacheSimInclude}) message(STATUS "libCacheSim found? ${libCacheSim}, ${libCacheSimInclude}") + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../../cmake/Modules/") find_package(GLib "2.40" REQUIRED) include_directories(${GLib_INCLUDE_DIRS}) message(STATUS "glib found? ${GLib_FOUND}, lib = ${GLib_LIBRARY}, header = ${GLib_INCLUDE_DIRS}") +find_package(ZSTD) +# https://stackoverflow.com/questions/61377055/cannot-find-gflags-gflags-h-while-building-library-osx/61379123#61379123 +include_directories(${ZSTD_INCLUDE_DIR}) +if ("${ZSTD_LIBRARIES}" STREQUAL "") + message(FATAL_ERROR "zstd not found") +endif() add_executable(cacheSimulatorMultiSize main.cpp) -target_link_libraries(cacheSimulatorMultiSize libCacheSim) +target_link_libraries(cacheSimulatorMultiSize libCacheSim m ${GLib_LIBRARY} ${ZSTD_LIBRARIES}) + diff --git a/example/cacheSimulatorConcurrent/README.md b/example/cacheSimulatorConcurrent/README.md index 73619b35..4093815f 100644 --- a/example/cacheSimulatorConcurrent/README.md +++ b/example/cacheSimulatorConcurrent/README.md @@ -1,7 +1,5 @@ ## Building a concurrent cache simulator -> WARN -> this has not been updated This tutorial shows how to build a concurrent cache simulator using libCacheSim. diff --git a/example/cacheSimulatorConcurrent/cmake/Modules/FindGLib.cmake b/example/cacheSimulatorConcurrent/cmake/Modules/FindGLib.cmake deleted file mode 100644 index 8939d857..00000000 --- a/example/cacheSimulatorConcurrent/cmake/Modules/FindGLib.cmake +++ /dev/null @@ -1,83 +0,0 @@ -# FindGLib.cmake -# -# -# CMake support for GLib/GObject/GIO. -# -# License: -# -# Copyright (c) 2016 Evan Nemerson -# -# Permission is hereby granted, free of charge, to any person -# obtaining a copy of this software and associated documentation -# files (the "Software"), to deal in the Software without -# restriction, including without limitation the rights to use, copy, -# modify, merge, publish, distribute, sublicense, and/or sell copies -# of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -find_package(PkgConfig) - -if(PKG_CONFIG_FOUND) - pkg_search_module(GLib_PKG glib-2.0) -endif() - -find_library(GLib_LIBRARY glib-2.0 HINTS ${GLib_PKG_LIBRARY_DIRS}) -set(GLib glib-2.0) - -if(GLib_LIBRARY AND NOT GLib_FOUND) - add_library(${GLib} SHARED IMPORTED) - set_property(TARGET ${GLib} PROPERTY IMPORTED_LOCATION "${GLib_LIBRARY}") - set_property(TARGET ${GLib} PROPERTY INTERFACE_COMPILE_OPTIONS "${GLib_PKG_CFLAGS_OTHER}") - - find_path(GLib_INCLUDE_DIRS "glib.h" - HINTS ${GLib_PKG_INCLUDE_DIRS} - PATH_SUFFIXES "glib-2.0") - - get_filename_component(GLib_LIBDIR "${GLib}" DIRECTORY) - find_path(GLib_CONFIG_INCLUDE_DIR "glibconfig.h" - HINTS - ${GLib_LIBDIR} - ${GLib_PKG_INCLUDE_DIRS} - PATHS - "${CMAKE_LIBRARY_PATH}" - PATH_SUFFIXES - "glib-2.0/include" - "glib-2.0") - unset(GLib_LIBDIR) - - if(GLib_CONFIG_INCLUDE_DIR) - file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MAJOR_VERSION REGEX "^#define GLIB_MAJOR_VERSION +([0-9]+)") - string(REGEX REPLACE "^#define GLIB_MAJOR_VERSION ([0-9]+)$" "\\1" GLib_MAJOR_VERSION "${GLib_MAJOR_VERSION}") - file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MINOR_VERSION REGEX "^#define GLIB_MINOR_VERSION +([0-9]+)") - string(REGEX REPLACE "^#define GLIB_MINOR_VERSION ([0-9]+)$" "\\1" GLib_MINOR_VERSION "${GLib_MINOR_VERSION}") - file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MICRO_VERSION REGEX "^#define GLIB_MICRO_VERSION +([0-9]+)") - string(REGEX REPLACE "^#define GLIB_MICRO_VERSION ([0-9]+)$" "\\1" GLib_MICRO_VERSION "${GLib_MICRO_VERSION}") - set(GLib_VERSION "${GLib_MAJOR_VERSION}.${GLib_MINOR_VERSION}.${GLib_MICRO_VERSION}") - unset(GLib_MAJOR_VERSION) - unset(GLib_MINOR_VERSION) - unset(GLib_MICRO_VERSION) - - list(APPEND GLib_INCLUDE_DIRS ${GLib_CONFIG_INCLUDE_DIR}) - set_property(TARGET ${GLib} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GLib_INCLUDE_DIRS}") - endif() -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(GLib - REQUIRED_VARS - GLib_LIBRARY - GLib_INCLUDE_DIRS - VERSION_VAR - GLib_VERSION) diff --git a/example/cacheSimulatorConcurrent/main.cpp b/example/cacheSimulatorConcurrent/main.cpp index f05f0673..1b583102 100644 --- a/example/cacheSimulatorConcurrent/main.cpp +++ b/example/cacheSimulatorConcurrent/main.cpp @@ -3,7 +3,7 @@ #include #define NUM_SIZES 8 -const char *TRACE_PATH = "../../../data/trace.csv"; +const char *TRACE_PATH = "../../../data/cloudPhysicsIO.csv"; void run_one_cache_multiple_sizes(cache_t *cache, reader_t *reader) { uint64_t cache_sizes[NUM_SIZES] = {100, 200, 400, 800, @@ -44,7 +44,7 @@ void run_multiple_caches(reader_t *reader) { cache_t *caches[8] = { LRU_init(cc_params, nullptr), LFU_init(cc_params, nullptr), - FIFO_init(cc_params, nullptr), SLRU_init(cc_params, nullptr), + FIFO_init(cc_params, nullptr), Sieve_init(cc_params, nullptr), LHD_init(cc_params, nullptr), LeCaR_init(cc_params, nullptr), ARC_init(cc_params, nullptr), NULL}; @@ -55,7 +55,7 @@ void run_multiple_caches(reader_t *reader) { cache_stat_t *result = simulate_with_multi_caches( reader, caches, 8, nullptr, 0.0, 0, - static_cast(std::thread::hardware_concurrency())); + static_cast(std::thread::hardware_concurrency()), 0); printf( " cache name cache size num_miss num_req"