analyse: start using fmtlib for printing
This commit is contained in:
parent
8acdab8111
commit
66ec824b44
@ -23,6 +23,11 @@ include_directories(.)
|
||||
add_subdirectory(cruft/util)
|
||||
add_subdirectory(cruft/crypto)
|
||||
|
||||
include (${CMAKE_BINARY_DIR}/conan_paths.cmake)
|
||||
|
||||
find_package (fmt REQUIRED)
|
||||
|
||||
|
||||
###############################################################################
|
||||
list(APPEND libemory_sources
|
||||
emory/chunk/fwd.cpp
|
||||
@ -68,7 +73,7 @@ set_target_properties(libemory PROPERTIES OUTPUT_NAME emory)
|
||||
###############################################################################
|
||||
foreach (t analyse compare stat)
|
||||
add_executable ("${t}" "tools/${t}.cpp")
|
||||
target_link_libraries ("${t}" libemory cruft-crypto cruft)
|
||||
target_link_libraries ("${t}" libemory cruft-crypto cruft fmt::fmt)
|
||||
set_target_properties ("${t}" PROPERTIES
|
||||
OUTPUT_NAME "emory-${t}"
|
||||
)
|
||||
|
15
conanfile.txt
Normal file
15
conanfile.txt
Normal file
@ -0,0 +1,15 @@
|
||||
[requires]
|
||||
fmt/[~=7]
|
||||
|
||||
[generators]
|
||||
cmake_find_package
|
||||
cmake_paths
|
||||
|
||||
[options]
|
||||
*:shared=True
|
||||
|
||||
[imports]
|
||||
bin, *.dll* -> bin
|
||||
bin, *.so* -> bin
|
||||
lib, *.dll* -> bin
|
||||
lib, *.so* -> bin
|
@ -14,6 +14,9 @@
|
||||
#include <cruft/util/view.hpp>
|
||||
#include <cruft/util/parse/value.hpp>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/compile.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <compare>
|
||||
@ -161,8 +164,14 @@ int main (int argc, char const **argv)
|
||||
);
|
||||
|
||||
auto const duplicated_bytes = total_bytes - unique_bytes;
|
||||
float const duplicated_fraction = 100.f * duplicated_bytes / total_bytes;
|
||||
float const duplicated_fraction = float (duplicated_bytes) / total_bytes;
|
||||
|
||||
fmt::print (
|
||||
"{} duplicated bytes of {} ({:.2f}%)\n",
|
||||
duplicated_bytes,
|
||||
total_bytes,
|
||||
100.f * duplicated_fraction
|
||||
);
|
||||
|
||||
std::cout << duplicated_bytes << " duplicated bytes of " << total_bytes << " (" << duplicated_fraction << "%)\n";
|
||||
std::cout << (src.elements.size () - unique.size ()) << " duplicates\n";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user