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:
90
third_party/tracy/python/bindings/Memory.hpp
vendored
Normal file
90
third_party/tracy/python/bindings/Memory.hpp
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
#pragma once
|
||||
|
||||
#include <pybind11/pybind11.h>
|
||||
namespace py = pybind11;
|
||||
|
||||
#include "NameBuffer.hpp"
|
||||
#include "tracy/Tracy.hpp"
|
||||
|
||||
using OptionalString = std::optional<std::string>;
|
||||
using OptionalInt = std::optional<int32_t>;
|
||||
|
||||
#ifdef TRACY_ENABLE
|
||||
template <typename Type = uint64_t>
|
||||
OptionalNumber MemoryAllocate(const Type &type, std::size_t size,
|
||||
const OptionalString &name = std::nullopt,
|
||||
const OptionalNumber &id = std::nullopt,
|
||||
OptionalInt depth = std::nullopt) {
|
||||
if (!name && !id) {
|
||||
if (!depth)
|
||||
TracyAlloc(reinterpret_cast<void *>(type), size);
|
||||
else
|
||||
TracyAllocS(reinterpret_cast<void *>(type), size, *depth);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
BufferEntry entry;
|
||||
|
||||
if (id) {
|
||||
entry.second = NameBuffer::Get(*id);
|
||||
if (!entry.second) return std::nullopt;
|
||||
} else {
|
||||
entry = NameBuffer::Add(*name);
|
||||
if (!entry.first) return std::nullopt;
|
||||
}
|
||||
|
||||
if (!depth)
|
||||
TracyAllocN(reinterpret_cast<void *>(type), size, entry.second);
|
||||
else
|
||||
TracyAllocNS(reinterpret_cast<void *>(type), size, *depth, entry.second);
|
||||
return entry.first;
|
||||
}
|
||||
|
||||
template <typename Type = uint64_t>
|
||||
bool MemoryFree(const Type &type, const OptionalNumber &id = std::nullopt,
|
||||
OptionalInt depth = std::nullopt) {
|
||||
if (!id) {
|
||||
if (!depth)
|
||||
TracyFree(reinterpret_cast<void *>(type));
|
||||
else
|
||||
TracyFreeS(reinterpret_cast<void *>(type), *depth);
|
||||
return true;
|
||||
}
|
||||
|
||||
auto ptr = NameBuffer::Get(*id);
|
||||
if (!ptr) return false;
|
||||
|
||||
if (!depth)
|
||||
TracyFreeN(reinterpret_cast<void *>(type), ptr);
|
||||
else
|
||||
TracyFreeNS(reinterpret_cast<void *>(type), *depth, ptr);
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
|
||||
template <typename Type = uint64_t>
|
||||
OptionalNumber MemoryAllocate(const Type &, std::size_t, const OptionalString &,
|
||||
const OptionalNumber &, OptionalInt) {
|
||||
return 0ul;
|
||||
}
|
||||
|
||||
template <typename Type = uint64_t>
|
||||
bool MemoryFree(const Type &, const OptionalNumber &, OptionalInt) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <>
|
||||
OptionalNumber MemoryAllocate(const py::object &object, std::size_t size,
|
||||
const OptionalString &name,
|
||||
const OptionalNumber &id, OptionalInt depth) {
|
||||
return MemoryAllocate<uint64_t>(reinterpret_cast<uint64_t>(object.ptr()),
|
||||
size, name, id, depth);
|
||||
}
|
||||
|
||||
template <>
|
||||
bool MemoryFree(const py::object &object, const OptionalNumber &id,
|
||||
OptionalInt depth) {
|
||||
return MemoryFree<uint64_t>(reinterpret_cast<uint64_t>(object.ptr()), id,
|
||||
depth);
|
||||
}
|
Reference in New Issue
Block a user