diff options
| author | Dean Michael Berris <dberris@google.com> | 2017-01-03 04:04:00 +0000 |
|---|---|---|
| committer | Dean Michael Berris <dberris@google.com> | 2017-01-03 04:04:00 +0000 |
| commit | 0aba35710f1db0254f8b2ba3a726d87390ff15ad (patch) | |
| tree | fee3db226d03dd7f4e1f64c7d2023bfc817d7969 /compiler-rt/lib/xray/xray_buffer_queue.h | |
| parent | 887894aaef8fe7b436d48dd825dbcf5dfd4cf3ad (diff) | |
| download | bcm5719-llvm-0aba35710f1db0254f8b2ba3a726d87390ff15ad.tar.gz bcm5719-llvm-0aba35710f1db0254f8b2ba3a726d87390ff15ad.zip | |
Revert "[XRay][compiler-rt] XRay Flight Data Recorder Mode"
This reverts rL290852 as it breaks aarch64 and arm.
llvm-svn: 290854
Diffstat (limited to 'compiler-rt/lib/xray/xray_buffer_queue.h')
| -rw-r--r-- | compiler-rt/lib/xray/xray_buffer_queue.h | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/compiler-rt/lib/xray/xray_buffer_queue.h b/compiler-rt/lib/xray/xray_buffer_queue.h index c6926e00209..bf0b7af9df4 100644 --- a/compiler-rt/lib/xray/xray_buffer_queue.h +++ b/compiler-rt/lib/xray/xray_buffer_queue.h @@ -21,7 +21,6 @@ #include <mutex> #include <system_error> #include <unordered_set> -#include <utility> namespace __xray { @@ -39,18 +38,14 @@ public: private: std::size_t BufferSize; - - // We use a bool to indicate whether the Buffer has been used in this - // freelist implementation. - std::deque<std::tuple<Buffer, bool>> Buffers; + std::deque<Buffer> Buffers; std::mutex Mutex; std::unordered_set<void *> OwnedBuffers; std::atomic<bool> Finalizing; public: - /// Initialise a queue of size |N| with buffers of size |B|. We report success - /// through |Success|. - BufferQueue(std::size_t B, std::size_t N, bool& Success); + /// Initialise a queue of size |N| with buffers of size |B|. + BufferQueue(std::size_t B, std::size_t N); /// Updates |Buf| to contain the pointer to an appropriate buffer. Returns an /// error in case there are no available buffers to return when we will run @@ -73,27 +68,15 @@ public: bool finalizing() const { return Finalizing.load(std::memory_order_acquire); } - /// Sets the state of the BufferQueue to finalizing, which ensures that: - /// - /// - All subsequent attempts to retrieve a Buffer will fail. - /// - All releaseBuffer operations will not fail. - /// - /// After a call to finalize succeeds, all subsequent calls to finalize will - /// fail with std::errc::state_not_recoverable. + // Sets the state of the BufferQueue to finalizing, which ensures that: + // + // - All subsequent attempts to retrieve a Buffer will fail. + // - All releaseBuffer operations will not fail. + // + // After a call to finalize succeeds, all subsequent calls to finalize will + // fail with std::errc::state_not_recoverable. std::error_code finalize(); - /// Applies the provided function F to each Buffer in the queue, only if the - /// Buffer is marked 'used' (i.e. has been the result of getBuffer(...) and a - /// releaseBuffer(...) operation. - template <class F> void apply(F Fn) { - std::lock_guard<std::mutex> G(Mutex); - for (const auto &T : Buffers) { - if (std::get<1>(T)) { - Fn(std::get<0>(T)); - } - } - } - // Cleans up allocated buffers. ~BufferQueue(); }; |

