proxygen
|
Classes | |
struct | ReaderData |
struct | WriterData |
Public Member Functions | |
ReadStats () | |
void | clearSleepDuration () |
std::chrono::microseconds | getSleepUS () const |
bool | shouldWriterStop () const |
void | writerFinished (size_t threadID, size_t messagesWritten, uint32_t flags) |
void | check () |
void | messageReceived (StringPiece msg) |
void | trailingData (StringPiece data) |
Private Member Functions | |
void | parseMessage (StringPiece msg, size_t *threadID, size_t *messageIndex) |
Private Attributes | |
std::unordered_map< size_t, ReaderData > | perThreadReadData_ |
std::string | trailingData_ |
size_t | numUnableToParse_ {0} |
size_t | numOutOfOrder_ {0} |
size_t | numDiscarded_ {0} |
const std::chrono::steady_clock::time_point | deadline_ |
std::atomic< uint64_t > | readSleepUS_ {0} |
std::atomic< uint64_t > | discardEventsSeen_ {0} |
folly::Synchronized< std::unordered_map< size_t, WriterData > > | perThreadWriteData_ |
Definition at line 271 of file AsyncFileWriterTest.cpp.
|
inline |
Definition at line 273 of file AsyncFileWriterTest.cpp.
References int64_t, min, now(), and uint64_t.
|
inline |
Definition at line 311 of file AsyncFileWriterTest.cpp.
References folly::DBG1, EXPECT_EQ, EXPECT_GT, EXPECT_LE, folly::LogWriter::NEVER_DISCARD, and XLOG.
Referenced by TEST().
|
inline |
|
inline |
|
inline |
Definition at line 360 of file AsyncFileWriterTest.cpp.
References folly::data(), folly::DBG3, folly::Range< Iter >::endsWith(), folly::ERR, folly::Range< Iter >::find(), folly::Range< Iter >::subpiece(), and XLOG.
Referenced by readThread().
|
inlineprivate |
Definition at line 405 of file AsyncFileWriterTest.cpp.
References folly::Range< Iter >::advance(), folly::Range< Iter >::endsWith(), folly::Range< Iter >::find(), kMsgSuffix, folly::Range< const char * >::npos, prefix(), folly::Range< Iter >::size(), folly::Range< Iter >::startsWith(), folly::Range< Iter >::subpiece(), and folly::Range< Iter >::subtract().
|
inline |
Definition at line 286 of file AsyncFileWriterTest.cpp.
References now(), and uint64_t.
Referenced by writeThread().
|
inline |
Definition at line 391 of file AsyncFileWriterTest.cpp.
References folly::Range< Iter >::str().
Referenced by readThread().
|
inline |
Definition at line 301 of file AsyncFileWriterTest.cpp.
References folly::data(), and FOLLY_SAFE_CHECK.
Referenced by writeThread().
|
private |
deadline_ is a maximum end time for the test.
The writer threads quit if the deadline is reached even if they have not produced the desired number of discard events yet.
Definition at line 466 of file AsyncFileWriterTest.cpp.
|
private |
A count of how many discard events have been seen so far.
The reader increments discardEventsSeen_ each time it sees a discard notification message. A "discard event" basically corresponds to a single group of dropped messages. Once the reader pulls some messages off out of the pipe the writers should be able to send more data, but the buffer will eventually fill up again, producing another discard event.
Definition at line 490 of file AsyncFileWriterTest.cpp.
|
private |
Definition at line 458 of file AsyncFileWriterTest.cpp.
|
private |
Definition at line 457 of file AsyncFileWriterTest.cpp.
|
private |
Definition at line 456 of file AsyncFileWriterTest.cpp.
|
private |
Data about each writer thread, as recorded by the reader thread.
At the end of the test we will compare perThreadReadData_ (recorded by the reader) with perThreadWriteData_ (recorded by the writers) to make sure the data matches up.
This is a map from writer_thread_id to ReaderData. The writer_thread_id is extracted from the received messages.
This field does not need locking as it is only updated by the single reader thread.
Definition at line 450 of file AsyncFileWriterTest.cpp.
|
private |
Data about each writer thread, as recorded by the writers.
When each writer thread finishes it records how many messages it wrote, plus the flags it used to write the messages.
Definition at line 499 of file AsyncFileWriterTest.cpp.
|
private |
How long the reader thread should sleep between each read event.
This is initially set to a non-zero value (read from the FLAGS_async_discard_read_sleep_usec flag) so that the reader thread reads slowly, which will fill up the pipe buffer and cause discard events.
Once we have produce enough discards and are ready to finish the test the main thread reduces readSleepUS_ to 0, so the reader will finish the remaining message backlog quickly.
Definition at line 479 of file AsyncFileWriterTest.cpp.
|
private |
Definition at line 455 of file AsyncFileWriterTest.cpp.