Bug fix for superslab meta-data (#302)
* Replace time measuring macro The DO_TIME macro was used originally to get performance numbers. The macro makes tests hard to debug. This commit replaces it with a proper C++ class with destructor. * Bug fix If the superslab meta data is large, then the calculation for the sizeclasses that could use the short slab was incorrect. This fixes that calculation. Co-authored-by: Nathaniel Wesley Filardo <nfilardo@microsoft.com>
This commit is contained in:
committed by
GitHub
parent
04a185e634
commit
63f231f484
@@ -3,12 +3,19 @@
|
||||
#include <chrono>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#define DO_TIME(name, code) \
|
||||
{ \
|
||||
auto start__ = std::chrono::high_resolution_clock::now(); \
|
||||
code auto finish__ = std::chrono::high_resolution_clock::now(); \
|
||||
auto diff__ = finish__ - start__; \
|
||||
std::cout << name << ": " << std::setw(12) << diff__.count() << " ns" \
|
||||
<< std::endl; \
|
||||
class MeasureTime : public std::stringstream
|
||||
{
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> start =
|
||||
std::chrono::high_resolution_clock::now();
|
||||
|
||||
public:
|
||||
~MeasureTime()
|
||||
{
|
||||
auto finish = std::chrono::high_resolution_clock::now();
|
||||
auto diff = finish - start;
|
||||
std::cout << str() << ": " << std::setw(12) << diff.count() << " ns"
|
||||
<< std::endl;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user