- 21 Jun, 2017 13 commits
-
-
Maged Michael authored
Summary: - Support empty hazptr_holder, move constructor and assignment operator - Limit thread caching to the default domain to improve performance of thread caching - Fix unnecessary calls to stats singleton - Use the mprotect version of AsymmetricMemoryBarrier for reducing the overhead of bulkReclaim(). - Update read-side benchmark results Reviewed By: djwatson Differential Revision: D5292885 fbshipit-source-id: bc5713ac95492a7114e1e467e71d2278e64b165d
-
Adam Simpkins authored
Summary: Remove the "LogLevel::" prefix from the logLevelToString() output. This makes the output shorter and easier to read, and makes it simpler to write LogFormatter implementations that want a short human-readable level description. Callers can always add a "LogLevel::" prefix on their own if desired. Reviewed By: wez Differential Revision: D5288601 fbshipit-source-id: 046579ebdda76842d5a44c33d68941d73dd81162
-
Giuseppe Ottaviano authored
Summary: The existing assertion errors do not give a lot of information to track down which thread is incorrectly using the `EventBase`. Print both the current thread name and the name of the thread running the event base loop. Reviewed By: luciang Differential Revision: D5289790 fbshipit-source-id: 563c7f68b7f9b7a6e85e22290d7e81afbf89871e
-
Victor Zverovich authored
Summary: Make `IndexedMemPool` call `Traits::onRecycle` on the element just before it is marked as deallocated. This mirrors the allocation behavior implemented in D5177462 and simplifies preventing access to recycled elements (the client just needs to check `isAllocated` before accessing the element). Reviewed By: nbronson Differential Revision: D5275283 fbshipit-source-id: 58365b5b7b32b07fa56529c476078f241fc20811
-
Christopher Dykes authored
Summary: Tests and benchmarks don't belong in the same directory as source code. Reviewed By: yfeldblum Differential Revision: D5288080 fbshipit-source-id: 865c6dfbeff751bda49870e5284e168d33aff256
-
Dave Watson authored
Summary: Original sys_membarrier call supported an EXPEDITED flag, that was much faster than the current version, at some extra CPU cost. The basic idea was a normal one would be used in a background thread, while EXPEDITED would be useful inline in foreground threads. Add the flag here, and use the mprotect hack until sys_membarrier supports both. Reviewed By: magedm Differential Revision: D5292680 fbshipit-source-id: 30edf27514976991bbaa8e776a7138eb815ade36
-
Petr Lapukhov authored
Summary: as title, similar to TTLS Reviewed By: djwatson Differential Revision: D5284200 fbshipit-source-id: 7eb95668740b239349c6e73f3b152e6506671072
-
Uladzislau Paulovich authored
Summary: Absence of "uint32" type in gFlagAdders map breaks all apps that use gflags of this type (i.e. define a flag with "DEFINE_uint32"). Reviewed By: WillerZ Differential Revision: D5286720 fbshipit-source-id: c02bd959cb9ea9a47fba1e01429181ba09edf5dd
-
Giuseppe Ottaviano authored
Summary: Complete the `ThreadName.h` API. Reviewed By: luciang, Orvid Differential Revision: D5289160 fbshipit-source-id: a48e61093008039da50b1c568364fa5b8744b401
-
Adam Simpkins authored
Summary: This refactors the logging code with the aim of reducing the amount of assembly code emitted for each log statement, particularly for `XLOG()` statements. Ideally it should be possible to put debug `XLOG()` statements throughout your code without having to worry about the performance overhead. Therefore we should attempt to make sure that `XLOG()` statements do not generate a lot of assembly and hurt icache performance. This diff does not have any code behavior changes--it just moves code around a bit. The high-level summary is: - Move as much code as possible into the LogStreamProcessor constructors and destructor. Make sure these methods are defined in LogStreamProcessor.cpp to avoid having them be emitted inline at each log statement. - Move some of the XLOG level checking logic into separate non-inline functions defined in xlog.cpp - Pass xlog category information around as a pair of (categoryName, isOverridden) parameters. If isOverridden is true then the categoryName parameter should be used as the category name directly. If isOverridden is false, then categoryName is a filename that needs to go through filename to category name string processing. This allows the category name processing to be done in non-inlined code. Reviewed By: wez Differential Revision: D5269976 fbshipit-source-id: 7a7877ddfed66cd27ed82f052330b6aa2be4b37b
-
Adam Simpkins authored
Summary: Add new `FB_LOGC()` and `XLOGC()` macros that accept C-style printf format strings. (The `FB_LOGF()` and `XLOGF()` macro names are already used for `folly::format()` style formatting.) This will make it easier for users to update existing printf-style code to use this new logging library. These are in a separate `printf.h` header file that must be explicitly included to have access to these macros. The intent is to encourage users to use one of the other APIs (streaming, append-style, or `folly::format()`) instead of these printf-like APIs in new code. Reviewed By: omry Differential Revision: D5269974 fbshipit-source-id: 56e55f9642bb00806d9b4c762fb6a91778ef6ad3
-
Adam Simpkins authored
Summary: The `XLOG_GET_CATEGORY()` macro was previously written assuming it was only used inside `XLOG()` statement. When used inside the main translation unit being compiled (e.g., a .cpp file and not a header file), the code assumed that the file-scope category had already been initialized, since a level check had presumably already been performed. However, it is useful in some places for external users (outside of the logging library itself) to call `XLOG_GET_CATEGORY()`. In these cases a log level check may not have been performed yet, so the file-scope category may not be initialized yet. This diff renames the existing `XLOG_GET_CATEGORY()` macro to `XLOG_GET_CATEGORY_INTERNAL()` and adds a new `XLOG_GET_CATEGORY()` macro that is slower (it always looks up the category by name) but always safe to use. This also adds a new `XLOG_GET_CATEGORY_NAME()` macro, and renames the existing `XLOG_SET_CATEGORY()` macro to `XLOG_SET_CATEGORY_NAME()` for API consistency. Reviewed By: wez Differential Revision: D5269975 fbshipit-source-id: 373805255823855282fa7a8d4a4d232ba06367f6
-
Adam Simpkins authored
Summary: This improves the test that exercises the AsyncFileWriter message discarding logic. Previously each writer thread wrote a fixed number of small messages. This was fairly slow, and wasn't always guaranteed to reliably produce discards. Now each writer thread writes larger messages, which produce discards faster. The test also automatically stops after 10 separate discard events, so that it finishes faster (typically a few hundred milliseconds, rather than 5+ seconds). This also updates the test to use XLOG() internally rather than using fprintf() to print to stderr, now that the XLOG() diffs have landed. Reviewed By: wez Differential Revision: D5261059 fbshipit-source-id: 120224706fee36948ef76efbeb579ccc56400c51
-
- 20 Jun, 2017 11 commits
-
-
Adam Simpkins authored
Summary: Add new `FATAL` and `DFATAL` log levels. Any log message with a level of `FATAL` always crashes the program. Log messages with a level of `DFATAL` crash the program in debug build modes. Before crashing, the code makes sure to flush all LogHandlers, so that the fatal message is not lost if some of the LogHandlers process messages asynchronously. If no LogHandlers were configured, the message is printed to stderr. Reviewed By: wez Differential Revision: D5189497 fbshipit-source-id: c45dbd582fb1c3a962d00effb2967737ef97cc8b
-
Maged Michael authored
Summary: Updated to the interface to be in synch with the latest standard proposal in P0233R4 as follows: - Renamed hazptr_owner as hazptr_holder. - Combined hazptr_holder member functions set() and clear() as reset(). - Replaced the template parameter A for hazptr_holder member function templates try_protect() and get_protected with atomic<T*>. - Moved the template parameter T from the class hazptr_holder to its member functions try_protect(), get_protected(), and reset(). - Added a non-template overload of hazptr_holder::reset() with an optional nullptr_t parameter. - Removed the template parameter T from the free function swap() as hazptr_holder is no longer a template. Reviewed By: davidtgoldblatt Differential Revision: D5283863 fbshipit-source-id: 2bc1a09f4f844aa72d9b7dff9c450540bbe09972
-
Qi Zhou authored
Summary: When - only one function is scheduled in FunctionScheduler; and - the function is running while cancelFunctionAndWait() is being called; FunctionScheduler.cancelFunctionAndWait() will hang forever. The root cause is that the condition in cancelFunctionAndWait() is incorrect: ``` runningCondvar_.wait(l, [currentFunction, this]() { return currentFunction != currentFunction_; }); ``` because currentFunction will not be changed if only one function is in the scheduler. The fix here is to - clear currentFunction as nullptr. This also makes the internal behaviors of cancelFunction() and cancelFunctionAndWait() consistent. - introduces additional variable to indicate the state of cancelling current function. After running the function, the background thread will detect cancellation of current function and clear the variable. - cancelFunctionAndWait() condition variable will wait for the variable to be cleared. Similarly, cancelAllFunctionsAndWait() also suffers from the same issue. Unit tests are added to reproduce the issue. Reviewed By: yfeldblum Differential Revision: D5271664 fbshipit-source-id: acb223304d3eab23129907ce9ff5e57e55f1e909
-
Adam Simpkins authored
Summary: Add a method to flush all LogHandler objects. This will be necessary to implement FB_LOG(FATAL), as we will want to flush all outstanding messages before crashing. Reviewed By: wez Differential Revision: D5189501 fbshipit-source-id: faf260b8e71e5dfed4a3b1c1aee32f072bd7b764
-
Adam Simpkins authored
Summary: Add a flush() call to the LogHandler interface. This is needed to implement `FB_LOG(FATAL)` so that we can flush all LogHandlers before aborting the program. Reviewed By: wez Differential Revision: D5189499 fbshipit-source-id: 75fa4d7e75ea26de5b7383bf7e8d073fb37e9309
-
Adam Simpkins authored
Summary: Add a flag to the LogWriter so we can ensure that particular messages are never discarded, even when the LogWriter is throttling messages. This functionality will be necessary to implement `FB_LOG(FATAL)` to that we can avoid discarding the reason for crashing. Reviewed By: wez Differential Revision: D5189498 fbshipit-source-id: dc4322ea5ba449a341cdbdc32afb0ed466019801
-
Adam Simpkins authored
Summary: This adds a small example program which demonstrates using the logging library. This gives a very basic example of how the library is intended to be used, and can also be used to play around with controlling the log levels from the command line argument. Reviewed By: wez Differential Revision: D5083104 fbshipit-source-id: ab09c6c88db33065f6e39f35b28014f2a6153cef
-
Christopher Dykes authored
Summary: It is not used anywhere, not even in tests, so kill it. Reviewed By: yfeldblum Differential Revision: D5280800 fbshipit-source-id: 7e6a308bf09198548b77dcc1bfacc0ee95eb4887
-
Christopher Dykes authored
Summary: This reverts commit 07639e155421f31a6cc7ed16cba2034750e44325 Differential Revision: D5278412 fbshipit-source-id: 4b4d60f1f472ebe2e68e8eea1a31f42bc55c60ed
-
Christopher Dykes authored
Summary: The only reason these were split was because of the use of `folly::format` Reviewed By: yfeldblum Differential Revision: D5278412 fbshipit-source-id: 07639e155421f31a6cc7ed16cba2034750e44325
-
Christopher Dykes authored
Summary: Because an `int` plays much much nicer with code already written for Windows than `void*` does. It takes quite a bit of hackery to make it possible with the pthread implementation we support using, but it is possible and is worth the effort. Reviewed By: yfeldblum Differential Revision: D5276968 fbshipit-source-id: 4cd0d3120a4f19976e76853ef4b337e96d5005a8
-
- 19 Jun, 2017 5 commits
-
-
Christopher Dykes authored
Summary: On Windows it has include order requirements. Reviewed By: yfeldblum Differential Revision: D5277151 fbshipit-source-id: a6cf923d78e5944ac34e885e32a7cf072f904720
-
Phil Willoughby authored
Reviewed By: yfeldblum Differential Revision: D5228760 fbshipit-source-id: bcad4237997e611e06c93b476c5b673dc93c0621
-
Christopher Dykes authored
Summary: It was broken by D5139886 which added a call to `std::__throw_bad_alloc` without first including the correct portability header. Reviewed By: yfeldblum Differential Revision: D5273016 fbshipit-source-id: cac1772f41ae5942a29cefa69fb07d9cf94b5aab
-
Christopher Dykes authored
Summary: I broke it when I moved the stats tests around. Reviewed By: yfeldblum Differential Revision: D5258526 fbshipit-source-id: 70982ffaaed89a548e943e4b011b013c89808666
-
Alan Frindell authored
Summary: It's not safe because of how it manipulates the linked list. The intended usage is to declare it locally on the stack Reviewed By: yfeldblum Differential Revision: D5267507 fbshipit-source-id: 07a55eaee2c6a266bb233432f6a3383236594195
-
- 18 Jun, 2017 1 commit
-
-
Christopher Dykes authored
Summary: They were incorrectly comparing against string literals rather than the actual demangled names. MSVC includes `class/struct` as part of the mangled name, so they also appear in the demangled name, in contrast to GCC/Clang, which don't. Reviewed By: yfeldblum Differential Revision: D5271087 fbshipit-source-id: 41fa0cebe098b1b935e1f8b1af5882c412cf6254
-
- 17 Jun, 2017 1 commit
-
-
Nathan Bronson authored
Summary: Improve documentation and use the correct pragma for warning on the unsupported path. Reviewed By: ot Differential Revision: D5264582 fbshipit-source-id: 710ee46fef6d8f37f665f4bb6f7e4c5dc0b27436
-
- 16 Jun, 2017 9 commits
-
-
Christopher Dykes authored
Summary: This reverts commit cd94c711f0390d249b6736ab292721a477022b02 Differential Revision: D4567233 fbshipit-source-id: a10aff6b4c231666aec9f40ab65e881c3cd870dc
-
Peter DeLong authored
Summary: get_fiber_manager_map_vevb() and get_fiber_manager_map_evb() don't provide very useful feedback when called with an empty map (just the former) or with a program that doesn't have debug symbols (both) Reviewed By: andriigrynenko Differential Revision: D5260114 fbshipit-source-id: c44b4e279e5c88dc08507b969339a4befc23d79b
-
Uladzislau Paulovich authored
Summary: Previous version failed to compile with "-Werror=shadow" flag, this commit fixes the problem. Reviewed By: WillerZ Differential Revision: D5255814 fbshipit-source-id: c1252474ed5415b47759022bcbabc78c1639e10a
-
Christopher Dykes authored
Summary: MSVC, GCC, and Clang define the relative comparison operators by default on `enum class` values, however under MSVC defining them explicitly causes the compiler to fail to resolve which operator to use, so just remove them entirely, as they aren't needed. Reviewed By: simpkins Differential Revision: D5259835 fbshipit-source-id: 1b91db5de0fc47320daabfdd7132ae910887ff0f
-
Christopher Dykes authored
Summary: There are a couple of places where the caught exception was being given a name that was never used, generating a warning under MSVC. Reviewed By: simpkins Differential Revision: D5260131 fbshipit-source-id: f82c6bd1266f6a4c916594ec3ac94edc9a2e48fe
-
Christopher Dykes authored
Summary: Glog doesn't try to, so there's no real reason to try and be smart. Just do the same thing as every other platform for now until we have reason to do otherwise. Reviewed By: simpkins Differential Revision: D5259435 fbshipit-source-id: dcdf55f51f2e13945afd351cb45e9c1a22f56218
-
Christopher Dykes authored
Summary: As MSVC correctly warns via C4266, the overload sets of functions in base classes are not part of the overload set in derived classes where you've declared an overload (or override) unless you've explicitly imported it. Reviewed By: simpkins Differential Revision: D5260056 fbshipit-source-id: bbbeeea3c13201a3a6eba6e62cfa5a49a9470d43
-
Christopher Dykes authored
Summary: It is needed on Windows for the `localtime_r` function. Reviewed By: simpkins Differential Revision: D5259944 fbshipit-source-id: e380ecf42252ecabec168cf87668ace3ff4c0a9f
-
Christopher Dykes authored
Summary: The standard does not define that `std::ostream` should have a default constructor, so this was invalid and was an error on Windows. This explicitly initializes the base class by passing a `nullptr`. Reviewed By: simpkins Differential Revision: D5259690 fbshipit-source-id: b8914d73ff2682e1a4447b8338860259778b2247
-