Skip to content

Commit c46f767

Browse files
committed
Disable ad-hoc mmap logging.
1 parent 8bd883e commit c46f767

File tree

2 files changed

+57
-57
lines changed

2 files changed

+57
-57
lines changed

include/bitcoin/database/memory/map.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ class BCD_API map
136136
bool resize_(size_t size) NOEXCEPT;
137137
bool finalize_(size_t size) NOEXCEPT;
138138

139-
void log(auto kind) NOEXCEPT;
140-
void log(auto kind, auto extra) NOEXCEPT;
139+
////void log(auto kind) NOEXCEPT;
140+
////void log(auto kind, auto extra) NOEXCEPT;
141141

142142
// Constants.
143143
const std::filesystem::path filename_;

src/memory/map.cpp

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -44,43 +44,43 @@ BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
4444

4545
using namespace system;
4646

47-
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48-
constexpr auto sp = " ";
49-
50-
enum logger
51-
{
52-
xopen,
53-
xmap,
54-
//xexpand,
55-
//xreserve,
56-
//xallocate,
57-
//xset,
58-
xremap,
59-
xflush,
60-
xunmap,
61-
xclose
62-
};
63-
64-
size_t ticks() NOEXCEPT
65-
{
66-
using clock = std::chrono::high_resolution_clock;
67-
static const auto start = clock::now();
68-
69-
using namespace std::chrono;
70-
const auto span = duration_cast<microseconds>(clock::now() - start);
71-
return to_unsigned(span.count());
72-
}
73-
74-
void map::log(auto kind) NOEXCEPT
75-
{
76-
std::cerr << ticks() << sp << kind << sp << opened_ << std::endl;
77-
}
78-
79-
void map::log(auto kind, auto extra) NOEXCEPT
80-
{
81-
std::cerr << ticks() << sp << kind << sp << opened_ << sp << extra << std::endl;
82-
}
83-
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47+
////// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48+
////constexpr auto sp = " ";
49+
////
50+
////enum logger
51+
////{
52+
//// xopen,
53+
//// xmap,
54+
//// //xexpand,
55+
//// //xreserve,
56+
//// //xallocate,
57+
//// //xset,
58+
//// xremap,
59+
//// xflush,
60+
//// xunmap,
61+
//// xclose
62+
////};
63+
////
64+
////size_t ticks() NOEXCEPT
65+
////{
66+
//// using clock = std::chrono::high_resolution_clock;
67+
//// static const auto start = clock::now();
68+
////
69+
//// using namespace std::chrono;
70+
//// const auto span = duration_cast<microseconds>(clock::now() - start);
71+
//// return to_unsigned(span.count());
72+
////}
73+
////
74+
////void map::log(auto kind) NOEXCEPT
75+
////{
76+
//// std::cerr << ticks() << sp << kind << sp << opened_ << std::endl;
77+
////}
78+
////
79+
////void map::log(auto kind, auto extra) NOEXCEPT
80+
////{
81+
//// std::cerr << ticks() << sp << kind << sp << opened_ << sp << extra << std::endl;
82+
////}
83+
////// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8484

8585
map::map(const path& filename, size_t minimum, size_t expansion,
8686
bool random) NOEXCEPT
@@ -116,9 +116,9 @@ code map::open() NOEXCEPT
116116
if (const auto ec = file::open_ex(opened_, filename_, random_))
117117
return ec;
118118

119-
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
120-
log(logger::xopen, filename_);
121-
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
119+
////// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
120+
////log(logger::xopen, filename_);
121+
////// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
122122
return file::size_ex(logical_, opened_);
123123
}
124124

@@ -133,9 +133,9 @@ code map::close() NOEXCEPT
133133
if (opened_ == file::invalid)
134134
return error::success;
135135

136-
// ~~~~~~~~~~~~~~~~~~
137-
log(logger::xclose);
138-
// ~~~~~~~~~~~~~~~~~~
136+
////// ~~~~~~~~~~~~~~~~~~
137+
////log(logger::xclose);
138+
////// ~~~~~~~~~~~~~~~~~~
139139
const auto descriptor = opened_;
140140
opened_ = file::invalid;
141141
logical_ = zero;
@@ -516,9 +516,9 @@ bool map::flush_() NOEXCEPT
516516
if (!success)
517517
set_first_code(error::fsync_failure);
518518

519-
// ~~~~~~~~~~~~~~~~~~
520-
log(logger::xflush);
521-
// ~~~~~~~~~~~~~~~~~~
519+
////// ~~~~~~~~~~~~~~~~~~
520+
////log(logger::xflush);
521+
////// ~~~~~~~~~~~~~~~~~~
522522
return success;
523523
}
524524

@@ -548,9 +548,9 @@ bool map::unmap_() NOEXCEPT
548548
capacity_ = zero;
549549
memory_map_ = {};
550550

551-
// ~~~~~~~~~~~~~~~~~~
552-
log(logger::xunmap);
553-
// ~~~~~~~~~~~~~~~~~~
551+
////// ~~~~~~~~~~~~~~~~~~
552+
////log(logger::xunmap);
553+
////// ~~~~~~~~~~~~~~~~~~
554554
return success;
555555
}
556556

@@ -568,9 +568,9 @@ bool map::map_() NOEXCEPT
568568
memory_map_ = pointer_cast<uint8_t>(::mmap(nullptr, size,
569569
PROT_READ | PROT_WRITE, MAP_SHARED, opened_, 0));
570570

571-
// ~~~~~~~~~~~~~~~~~~
572-
log(logger::xmap);
573-
// ~~~~~~~~~~~~~~~~~~
571+
////// ~~~~~~~~~~~~~~~~~~
572+
////log(logger::xmap);
573+
////// ~~~~~~~~~~~~~~~~~~
574574
return finalize_(size);
575575
}
576576

@@ -616,9 +616,9 @@ bool map::remap_(size_t size) NOEXCEPT
616616
PROT_READ | PROT_WRITE, MAP_SHARED, opened_, 0));
617617
#endif
618618

619-
// ~~~~~~~~~~~~~~~~~~
620-
log(logger::xremap);
621-
// ~~~~~~~~~~~~~~~~~~
619+
////// ~~~~~~~~~~~~~~~~~~
620+
////log(logger::xremap);
621+
////// ~~~~~~~~~~~~~~~~~~
622622
return finalize_(size);
623623
}
624624

0 commit comments

Comments
 (0)