fix: breakpad use miniz
Some checks failed
sm-rpc / build (Debug, arm-linux-gnueabihf) (push) Successful in 1m34s
sm-rpc / build (Debug, aarch64-linux-gnu) (push) Successful in 2m46s
sm-rpc / build (Debug, host.gcc) (push) Failing after 1m28s
sm-rpc / build (Release, aarch64-linux-gnu) (push) Successful in 2m14s
sm-rpc / build (Release, arm-linux-gnueabihf) (push) Successful in 2m8s
sm-rpc / build (Debug, mipsel-linux-gnu) (push) Successful in 5m35s
sm-rpc / build (Release, host.gcc) (push) Failing after 1m55s
sm-rpc / build (Release, mipsel-linux-gnu) (push) Successful in 7m21s
Some checks failed
sm-rpc / build (Debug, arm-linux-gnueabihf) (push) Successful in 1m34s
sm-rpc / build (Debug, aarch64-linux-gnu) (push) Successful in 2m46s
sm-rpc / build (Debug, host.gcc) (push) Failing after 1m28s
sm-rpc / build (Release, aarch64-linux-gnu) (push) Successful in 2m14s
sm-rpc / build (Release, arm-linux-gnueabihf) (push) Successful in 2m8s
sm-rpc / build (Debug, mipsel-linux-gnu) (push) Successful in 5m35s
sm-rpc / build (Release, host.gcc) (push) Failing after 1m55s
sm-rpc / build (Release, mipsel-linux-gnu) (push) Successful in 7m21s
This commit is contained in:
59
third_party/tracy/python/bindings/NameBuffer.hpp
vendored
Normal file
59
third_party/tracy/python/bindings/NameBuffer.hpp
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
#pragma once
|
||||
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifndef BUFFER_SIZE
|
||||
#define BUFFER_SIZE = 128
|
||||
#endif
|
||||
|
||||
#ifndef NAME_LENGTH
|
||||
#define NAME_LENGTH = 128
|
||||
#endif
|
||||
|
||||
using OptionalNumber = std::optional<std::size_t>;
|
||||
using BufferEntry = std::pair<OptionalNumber, const char*>;
|
||||
|
||||
class NameBuffer {
|
||||
public:
|
||||
static inline BufferEntry Add(const std::string& name) {
|
||||
return getBuffer().add(name);
|
||||
}
|
||||
|
||||
static inline const char* Get(std::size_t index) {
|
||||
return getBuffer().get(index);
|
||||
}
|
||||
|
||||
private:
|
||||
NameBuffer() : m_buffer(BUFFER_SIZE, nullptr), m_index(0ul) {
|
||||
for (std::size_t index = 0ul, end = m_buffer.size(); index < end; ++index)
|
||||
m_buffer[index] = new char[NAME_LENGTH];
|
||||
}
|
||||
|
||||
std::mutex m_mutex;
|
||||
std::vector<char*> m_buffer;
|
||||
std::size_t m_index;
|
||||
|
||||
static inline NameBuffer& getBuffer() {
|
||||
static NameBuffer buffer;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
BufferEntry add(const std::string& name) {
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
if (m_index >= BUFFER_SIZE || name.size() > NAME_LENGTH)
|
||||
return std::make_pair(std::nullopt, nullptr);
|
||||
|
||||
auto index = m_index++;
|
||||
name.copy(m_buffer[index], name.size());
|
||||
return std::make_pair(index, m_buffer[index]);
|
||||
}
|
||||
|
||||
const char* get(std::size_t index) {
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
if (index >= BUFFER_SIZE) return nullptr;
|
||||
return m_buffer[index];
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user