mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Merge 85f14314d0146378d0d7a442697dc4abc79123c7 into ac031e64d64e64aa5cb332a47e405d037bb827bd
This commit is contained in:
commit
d14ef82bed
@ -16,6 +16,14 @@ else ifeq (0,$(shell ld -ltbb -o /dev/null 2>/dev/null; echo $$?))
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
ifeq ($(shell uname -o),Haiku)
|
||||||
|
LIBS += -lroot -lnetwork -luuid
|
||||||
|
else
|
||||||
|
LIBS += -ldl
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
OBJDIRBASE := obj/$(BUILD)
|
OBJDIRBASE := obj/$(BUILD)
|
||||||
OBJDIR := $(OBJDIRBASE)/o/o/o
|
OBJDIR := $(OBJDIRBASE)/o/o/o
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ CFLAGS +=
|
|||||||
CXXFLAGS := $(CFLAGS) -std=c++11 -fpic
|
CXXFLAGS := $(CFLAGS) -std=c++11 -fpic
|
||||||
DEFINES += -DTRACY_ENABLE
|
DEFINES += -DTRACY_ENABLE
|
||||||
INCLUDES :=
|
INCLUDES :=
|
||||||
LIBS := -lpthread -ldl
|
LIBS := -lpthread
|
||||||
PROJECT := libtracy
|
PROJECT := libtracy
|
||||||
IMAGE := $(PROJECT)-$(BUILD).so
|
IMAGE := $(PROJECT)-$(BUILD).so
|
||||||
SHARED_LIBRARY := yes
|
SHARED_LIBRARY := yes
|
||||||
|
|||||||
80
nfd/nfd_haiku.cpp
Normal file
80
nfd/nfd_haiku.cpp
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
#include "nfd.h"
|
||||||
|
|
||||||
|
#include <FilePanel.h>
|
||||||
|
#include <Window.h>
|
||||||
|
#include <Path.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
nfdresult_t NFD_Init(void) {
|
||||||
|
return NFD_OKAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NFD_Quit(void) {}
|
||||||
|
|
||||||
|
static nfdresult_t dialog(BFilePanel &p, nfdnchar_t **outPath,
|
||||||
|
const nfdnfilteritem_t *filterList,
|
||||||
|
nfdfiltersize_t filterCount) {
|
||||||
|
p.Show();
|
||||||
|
while (p.IsShowing())
|
||||||
|
usleep(100000);
|
||||||
|
entry_ref sel;
|
||||||
|
if (p.GetNextSelectedRef(&sel) == B_OK) {
|
||||||
|
BEntry e(&sel);
|
||||||
|
BPath path;
|
||||||
|
if (e.GetPath(&path) == B_OK) {
|
||||||
|
outPath[0] = strdup(path.Path());
|
||||||
|
return NFD_OKAY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NFD_CANCEL;
|
||||||
|
}
|
||||||
|
|
||||||
|
class NFDFilter : public BRefFilter {
|
||||||
|
const nfdnfilteritem_t * _filter;
|
||||||
|
nfdfiltersize_t _count;
|
||||||
|
public:
|
||||||
|
NFDFilter(const nfdnfilteritem_t *filterList, nfdfiltersize_t filterCount)
|
||||||
|
: _filter(filterList)
|
||||||
|
, _count(filterCount) {}
|
||||||
|
|
||||||
|
bool Filter(const entry_ref *ref, BNode *node, struct stat_beos *stat,
|
||||||
|
const char *mimeType) override {
|
||||||
|
BString name(ref->name);
|
||||||
|
if (node->IsDirectory())
|
||||||
|
return true;
|
||||||
|
for (auto i = 0; i < _count; i++)
|
||||||
|
if (name.EndsWith(_filter[0].spec))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
nfdresult_t
|
||||||
|
NFD_OpenDialogN(nfdnchar_t **outPath, const nfdnfilteritem_t *filterList,
|
||||||
|
nfdfiltersize_t filterCount, const nfdnchar_t *defaultPath) {
|
||||||
|
NFDFilter f(filterList, filterCount);
|
||||||
|
BFilePanel p(B_OPEN_PANEL, NULL, NULL, 0, false, NULL, &f, true, true);
|
||||||
|
p.Window()->SetTitle(filterList[0].name);
|
||||||
|
if (defaultPath)
|
||||||
|
p.SetPanelDirectory(defaultPath);
|
||||||
|
return dialog(p, outPath, filterList, filterCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
nfdresult_t NFD_SaveDialogN(nfdnchar_t** outPath,
|
||||||
|
const nfdnfilteritem_t* filterList,
|
||||||
|
nfdfiltersize_t filterCount,
|
||||||
|
const nfdnchar_t* defaultPath,
|
||||||
|
const nfdnchar_t* defaultName) {
|
||||||
|
NFDFilter f(filterList, filterCount);
|
||||||
|
BFilePanel p(B_SAVE_PANEL, NULL, NULL, 0, false, NULL, &f, true, true);
|
||||||
|
p.Window()->SetTitle(filterList[0].name);
|
||||||
|
if (defaultPath)
|
||||||
|
p.SetPanelDirectory(defaultPath);
|
||||||
|
if (defaultName)
|
||||||
|
p.SetSaveText(defaultName);
|
||||||
|
return dialog(p, outPath, filterList, filterCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NFD_FreePathN(nfdnchar_t* filePath) {
|
||||||
|
free(filePath);
|
||||||
|
}
|
||||||
@ -16,7 +16,20 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h> // for access()
|
#include <unistd.h> // for access()
|
||||||
|
|
||||||
#if !defined(__has_include) || !defined(__linux__)
|
#if defined __HAIKU__
|
||||||
|
#include <uuid/uuid.h>
|
||||||
|
static inline size_t szmin(size_t a, size_t b) {
|
||||||
|
return a < b? a : b;
|
||||||
|
}
|
||||||
|
static inline ssize_t getrandom(unsigned char * buf, size_t buflen, unsigned int flags) {
|
||||||
|
for (size_t i = 0; i < buflen; i += sizeof(uuid_t)) {
|
||||||
|
uuid_t uuid;
|
||||||
|
uuid_generate_random(uuid);
|
||||||
|
memcpy(buf+i, uuid, szmin(buflen-i, sizeof(uuid)));
|
||||||
|
}
|
||||||
|
return buflen;
|
||||||
|
}
|
||||||
|
#elif !defined(__has_include) || !defined(__linux__)
|
||||||
#include <sys/random.h> // for getrandom() - the random token string
|
#include <sys/random.h> // for getrandom() - the random token string
|
||||||
#elif __has_include(<sys/random.h>)
|
#elif __has_include(<sys/random.h>)
|
||||||
#include <sys/random.h>
|
#include <sys/random.h>
|
||||||
|
|||||||
@ -2,7 +2,7 @@ CFLAGS +=
|
|||||||
CXXFLAGS := $(CFLAGS) -std=c++17
|
CXXFLAGS := $(CFLAGS) -std=c++17
|
||||||
DEFINES += -DIMGUI_ENABLE_FREETYPE
|
DEFINES += -DIMGUI_ENABLE_FREETYPE
|
||||||
INCLUDES := -I../../../imgui $(shell pkg-config --cflags freetype2 capstone wayland-egl egl wayland-cursor xkbcommon)
|
INCLUDES := -I../../../imgui $(shell pkg-config --cflags freetype2 capstone wayland-egl egl wayland-cursor xkbcommon)
|
||||||
LIBS := $(shell pkg-config --libs freetype2 capstone wayland-egl egl wayland-cursor xkbcommon) -lpthread -ldl
|
LIBS := $(shell pkg-config --libs freetype2 capstone wayland-egl egl wayland-cursor xkbcommon) -lpthread
|
||||||
|
|
||||||
PROJECT := Tracy
|
PROJECT := Tracy
|
||||||
IMAGE := $(PROJECT)-$(BUILD)
|
IMAGE := $(PROJECT)-$(BUILD)
|
||||||
@ -20,11 +20,16 @@ else
|
|||||||
SRC += ../../../nfd/nfd_gtk.cpp
|
SRC += ../../../nfd/nfd_gtk.cpp
|
||||||
INCLUDES += $(shell pkg-config --cflags gtk+-3.0)
|
INCLUDES += $(shell pkg-config --cflags gtk+-3.0)
|
||||||
LIBS += $(shell pkg-config --libs gtk+-3.0)
|
LIBS += $(shell pkg-config --libs gtk+-3.0)
|
||||||
|
else
|
||||||
|
ifeq ($(shell uname -o),Haiku)
|
||||||
|
SRC += ../../../nfd/nfd_haiku.cpp
|
||||||
|
LIBS += -lbe -ltracker
|
||||||
else
|
else
|
||||||
SRC += ../../../nfd/nfd_portal.cpp
|
SRC += ../../../nfd/nfd_portal.cpp
|
||||||
INCLUDES += $(shell pkg-config --cflags dbus-1)
|
INCLUDES += $(shell pkg-config --cflags dbus-1)
|
||||||
LIBS += $(shell pkg-config --libs dbus-1)
|
LIBS += $(shell pkg-config --libs dbus-1)
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
include ../../../common/unix.mk
|
include ../../../common/unix.mk
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
CFLAGS := -g3 -Wall
|
CFLAGS := -g3 -Wall
|
||||||
|
LDFLAGS := -g3
|
||||||
DEFINES := -DDEBUG
|
DEFINES := -DDEBUG
|
||||||
BUILD := debug
|
BUILD := debug
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ CFLAGS +=
|
|||||||
CXXFLAGS := $(CFLAGS) -std=c++17
|
CXXFLAGS := $(CFLAGS) -std=c++17
|
||||||
DEFINES += -DIMGUI_ENABLE_FREETYPE
|
DEFINES += -DIMGUI_ENABLE_FREETYPE
|
||||||
INCLUDES := -I../../../imgui $(shell pkg-config --cflags glfw3 freetype2 capstone)
|
INCLUDES := -I../../../imgui $(shell pkg-config --cflags glfw3 freetype2 capstone)
|
||||||
LIBS := $(shell pkg-config --libs glfw3 freetype2 capstone) -lpthread -ldl
|
LIBS := $(shell pkg-config --libs glfw3 freetype2 capstone) -lpthread
|
||||||
|
|
||||||
PROJECT := Tracy
|
PROJECT := Tracy
|
||||||
IMAGE := $(PROJECT)-$(BUILD)
|
IMAGE := $(PROJECT)-$(BUILD)
|
||||||
@ -22,12 +22,17 @@ else
|
|||||||
SRC += ../../../nfd/nfd_gtk.cpp
|
SRC += ../../../nfd/nfd_gtk.cpp
|
||||||
INCLUDES += $(shell pkg-config --cflags gtk+-3.0)
|
INCLUDES += $(shell pkg-config --cflags gtk+-3.0)
|
||||||
LIBS += $(shell pkg-config --libs gtk+-3.0)
|
LIBS += $(shell pkg-config --libs gtk+-3.0)
|
||||||
|
else
|
||||||
|
ifeq ($(shell uname -o),Haiku)
|
||||||
|
SRC += ../../../nfd/nfd_haiku.cpp
|
||||||
|
LIBS += -lbe -ltracker
|
||||||
else
|
else
|
||||||
SRC += ../../../nfd/nfd_portal.cpp
|
SRC += ../../../nfd/nfd_portal.cpp
|
||||||
INCLUDES += $(shell pkg-config --cflags dbus-1)
|
INCLUDES += $(shell pkg-config --cflags dbus-1)
|
||||||
LIBS += $(shell pkg-config --libs dbus-1)
|
LIBS += $(shell pkg-config --libs dbus-1)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
include ../../../common/unix.mk
|
include ../../../common/unix.mk
|
||||||
|
|||||||
@ -68,6 +68,8 @@ static const char* GetOsInfo()
|
|||||||
sprintf( buf, "BSD (OpenBSD)" );
|
sprintf( buf, "BSD (OpenBSD)" );
|
||||||
#elif defined __QNX__
|
#elif defined __QNX__
|
||||||
sprintf( buf, "QNX" );
|
sprintf( buf, "QNX" );
|
||||||
|
#elif defined __HAIKU__
|
||||||
|
sprintf( buf, "Haiku" );
|
||||||
#else
|
#else
|
||||||
sprintf( buf, "unknown" );
|
sprintf( buf, "unknown" );
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -117,7 +117,11 @@
|
|||||||
#endif
|
#endif
|
||||||
#define GLFW_HAS_FOCUS_WINDOW (GLFW_VERSION_COMBINED >= 3200) // 3.2+ glfwFocusWindow
|
#define GLFW_HAS_FOCUS_WINDOW (GLFW_VERSION_COMBINED >= 3200) // 3.2+ glfwFocusWindow
|
||||||
#define GLFW_HAS_FOCUS_ON_SHOW (GLFW_VERSION_COMBINED >= 3300) // 3.3+ GLFW_FOCUS_ON_SHOW
|
#define GLFW_HAS_FOCUS_ON_SHOW (GLFW_VERSION_COMBINED >= 3300) // 3.3+ GLFW_FOCUS_ON_SHOW
|
||||||
|
#if defined __HAIKU__
|
||||||
|
#define GLFW_HAS_MONITOR_WORK_AREA 0 // Crashes
|
||||||
|
#else
|
||||||
#define GLFW_HAS_MONITOR_WORK_AREA (GLFW_VERSION_COMBINED >= 3300) // 3.3+ glfwGetMonitorWorkarea
|
#define GLFW_HAS_MONITOR_WORK_AREA (GLFW_VERSION_COMBINED >= 3300) // 3.3+ glfwGetMonitorWorkarea
|
||||||
|
#endif
|
||||||
#define GLFW_HAS_OSX_WINDOW_POS_FIX (GLFW_VERSION_COMBINED >= 3301) // 3.3.1+ Fixed: Resizing window repositions it on MacOS #1553
|
#define GLFW_HAS_OSX_WINDOW_POS_FIX (GLFW_VERSION_COMBINED >= 3301) // 3.3.1+ Fixed: Resizing window repositions it on MacOS #1553
|
||||||
#ifdef GLFW_RESIZE_NESW_CURSOR // Let's be nice to people who pulled GLFW between 2019-04-16 (3.4 define) and 2019-11-29 (cursors defines) // FIXME: Remove when GLFW 3.4 is released?
|
#ifdef GLFW_RESIZE_NESW_CURSOR // Let's be nice to people who pulled GLFW between 2019-04-16 (3.4 define) and 2019-11-29 (cursors defines) // FIXME: Remove when GLFW 3.4 is released?
|
||||||
#define GLFW_HAS_NEW_CURSORS (GLFW_VERSION_COMBINED >= 3400) // 3.4+ GLFW_RESIZE_ALL_CURSOR, GLFW_RESIZE_NESW_CURSOR, GLFW_RESIZE_NWSE_CURSOR, GLFW_NOT_ALLOWED_CURSOR
|
#define GLFW_HAS_NEW_CURSORS (GLFW_VERSION_COMBINED >= 3400) // 3.4+ GLFW_RESIZE_ALL_CURSOR, GLFW_RESIZE_NESW_CURSOR, GLFW_RESIZE_NWSE_CURSOR, GLFW_NOT_ALLOWED_CURSOR
|
||||||
|
|||||||
@ -685,7 +685,13 @@ static int open_libgl(void)
|
|||||||
libgl = dlopen("libGL.so.3", RTLD_LAZY | RTLD_LOCAL);
|
libgl = dlopen("libGL.so.3", RTLD_LAZY | RTLD_LOCAL);
|
||||||
if (!libgl)
|
if (!libgl)
|
||||||
return GL3W_ERROR_LIBRARY_OPEN;
|
return GL3W_ERROR_LIBRARY_OPEN;
|
||||||
*(void **)(&glx_get_proc_address) = dlsym(libgl, "glXGetProcAddressARB");
|
*(void **)(&glx_get_proc_address) = dlsym(libgl,
|
||||||
|
#if defined __HAIKU__
|
||||||
|
"_glapi_get_proc_address"
|
||||||
|
#else
|
||||||
|
"glXGetProcAddressARB"
|
||||||
|
#endif
|
||||||
|
);
|
||||||
return GL3W_OK;
|
return GL3W_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,8 @@
|
|||||||
# define TRACY_HAS_CALLSTACK 4
|
# define TRACY_HAS_CALLSTACK 4
|
||||||
# elif defined BSD
|
# elif defined BSD
|
||||||
# define TRACY_HAS_CALLSTACK 6
|
# define TRACY_HAS_CALLSTACK 6
|
||||||
|
# elif defined __HAIKU__
|
||||||
|
# define TRACY_HAS_CALLSTACK 2
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifdef TRACY_ENABLE
|
#ifdef TRACY_ENABLE
|
||||||
# ifdef __linux__
|
# if defined __linux__ || defined __HAIKU__
|
||||||
# include "TracyDebug.hpp"
|
# include "TracyDebug.hpp"
|
||||||
# ifdef TRACY_VERBOSE
|
# ifdef TRACY_VERBOSE
|
||||||
# include <dlfcn.h>
|
# include <dlfcn.h>
|
||||||
|
|||||||
@ -90,7 +90,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#if defined __APPLE__ || defined __HAIKU__
|
||||||
# ifndef TRACY_DELAYED_INIT
|
# ifndef TRACY_DELAYED_INIT
|
||||||
# define TRACY_DELAYED_INIT
|
# define TRACY_DELAYED_INIT
|
||||||
# endif
|
# endif
|
||||||
@ -418,10 +418,31 @@ static const char* GetProcessName()
|
|||||||
if( buf ) processName = buf;
|
if( buf ) processName = buf;
|
||||||
#elif defined __QNX__
|
#elif defined __QNX__
|
||||||
processName = __progname;
|
processName = __progname;
|
||||||
|
#elif defined __HAIKU__
|
||||||
|
team_info ti;
|
||||||
|
get_team_info(B_CURRENT_TEAM, &ti);
|
||||||
|
static char name[B_OS_NAME_LENGTH];
|
||||||
|
memcpy(name, ti.name, sizeof(name));
|
||||||
|
processName = name;
|
||||||
#endif
|
#endif
|
||||||
return processName;
|
return processName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if defined __HAIKU__
|
||||||
|
#include <image.h>
|
||||||
|
static char executable_path[MAXPATHLEN];
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
initialize_before(image_id our_image)
|
||||||
|
{
|
||||||
|
image_info ii;
|
||||||
|
get_image_info(our_image, &ii);
|
||||||
|
snprintf(executable_path, sizeof(executable_path), "%s", ii.name);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static const char* GetProcessExecutablePath()
|
static const char* GetProcessExecutablePath()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -459,6 +480,8 @@ static const char* GetProcessExecutablePath()
|
|||||||
static char buf[_PC_PATH_MAX + 1];
|
static char buf[_PC_PATH_MAX + 1];
|
||||||
_cmdname(buf);
|
_cmdname(buf);
|
||||||
return buf;
|
return buf;
|
||||||
|
#elif defined __HAIKU__
|
||||||
|
return executable_path;
|
||||||
#else
|
#else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
#endif
|
#endif
|
||||||
@ -539,6 +562,8 @@ static const char* GetHostInfo()
|
|||||||
ptr += sprintf( ptr, "OS: BSD (OpenBSD)\n" );
|
ptr += sprintf( ptr, "OS: BSD (OpenBSD)\n" );
|
||||||
#elif defined __QNX__
|
#elif defined __QNX__
|
||||||
ptr += sprintf( ptr, "OS: QNX\n" );
|
ptr += sprintf( ptr, "OS: QNX\n" );
|
||||||
|
#elif defined __HAIKU__
|
||||||
|
ptr += sprintf( ptr, "OS: Haiku\n" );
|
||||||
#else
|
#else
|
||||||
ptr += sprintf( ptr, "OS: unknown\n" );
|
ptr += sprintf( ptr, "OS: unknown\n" );
|
||||||
#endif
|
#endif
|
||||||
@ -726,6 +751,11 @@ static const char* GetHostInfo()
|
|||||||
}
|
}
|
||||||
memSize = memSize / 1024 / 1024;
|
memSize = memSize / 1024 / 1024;
|
||||||
ptr += sprintf( ptr, "RAM: %llu MB\n", memSize);
|
ptr += sprintf( ptr, "RAM: %llu MB\n", memSize);
|
||||||
|
#elif defined __HAIKU__
|
||||||
|
system_info si;
|
||||||
|
get_system_info(&si);
|
||||||
|
size_t memSize = si.max_pages * PAGESIZE;
|
||||||
|
ptr += sprintf( ptr, "RAM: %zu MB\n", memSize / 1024 / 1024);
|
||||||
#else
|
#else
|
||||||
ptr += sprintf( ptr, "RAM: unknown\n" );
|
ptr += sprintf( ptr, "RAM: unknown\n" );
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#if !defined __HAIKU__
|
||||||
#include <linux/perf_event.h>
|
#include <linux/perf_event.h>
|
||||||
|
#endif
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
|||||||
@ -78,6 +78,25 @@ void SysTime::ReadTimes()
|
|||||||
idle = data[4];
|
idle = data[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# elif defined __HAIKU__
|
||||||
|
|
||||||
|
void SysTime::ReadTimes()
|
||||||
|
{
|
||||||
|
bigtime_t now = system_time();
|
||||||
|
system_info si;
|
||||||
|
get_system_info(&si);
|
||||||
|
cpu_info ci[256];
|
||||||
|
get_cpu_info(0, si.cpu_count, ci);
|
||||||
|
bigtime_t tot = 0;
|
||||||
|
for (uint32 i = 0; i < si.cpu_count; i++)
|
||||||
|
tot += ci[i].active_time;
|
||||||
|
used = tot / si.cpu_count;
|
||||||
|
static bigtime_t prev;
|
||||||
|
bigtime_t interval = now - prev;
|
||||||
|
idle = interval - used;
|
||||||
|
prev = now;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SysTime::SysTime()
|
SysTime::SysTime()
|
||||||
@ -97,7 +116,7 @@ float SysTime::Get()
|
|||||||
|
|
||||||
#if defined _WIN32
|
#if defined _WIN32
|
||||||
return diffUsed == 0 ? -1 : ( diffUsed - diffIdle ) * 100.f / diffUsed;
|
return diffUsed == 0 ? -1 : ( diffUsed - diffIdle ) * 100.f / diffUsed;
|
||||||
#elif defined __linux__ || defined __APPLE__ || defined BSD
|
#elif defined __linux__ || defined __APPLE__ || defined BSD || defined __HAIKU__
|
||||||
const auto total = diffUsed + diffIdle;
|
const auto total = diffUsed + diffIdle;
|
||||||
return total == 0 ? -1 : diffUsed * 100.f / total;
|
return total == 0 ? -1 : diffUsed * 100.f / total;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#ifndef __TRACYSYSTIME_HPP__
|
#ifndef __TRACYSYSTIME_HPP__
|
||||||
#define __TRACYSYSTIME_HPP__
|
#define __TRACYSYSTIME_HPP__
|
||||||
|
|
||||||
#if defined _WIN32 || defined __linux__ || defined __APPLE__
|
#if defined _WIN32 || defined __linux__ || defined __APPLE__ || defined __HAIKU__
|
||||||
# define TRACY_HAS_SYSTIME
|
# define TRACY_HAS_SYSTIME
|
||||||
#else
|
#else
|
||||||
# include <sys/param.h>
|
# include <sys/param.h>
|
||||||
|
|||||||
@ -37,6 +37,10 @@
|
|||||||
# define MSG_NOSIGNAL 0
|
# define MSG_NOSIGNAL 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined __HAIKU__
|
||||||
|
#define TRACY_ONLY_IPV4
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -492,7 +496,7 @@ bool ListenSocket::Listen( uint16_t port, int backlog )
|
|||||||
#if defined _WIN32
|
#if defined _WIN32
|
||||||
unsigned long val = 0;
|
unsigned long val = 0;
|
||||||
setsockopt( m_sock, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&val, sizeof( val ) );
|
setsockopt( m_sock, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&val, sizeof( val ) );
|
||||||
#elif defined BSD
|
#elif defined BSD || defined __HAIKU__
|
||||||
int val = 0;
|
int val = 0;
|
||||||
setsockopt( m_sock, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&val, sizeof( val ) );
|
setsockopt( m_sock, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&val, sizeof( val ) );
|
||||||
val = 1;
|
val = 1;
|
||||||
|
|||||||
@ -31,6 +31,8 @@
|
|||||||
#elif defined __QNX__
|
#elif defined __QNX__
|
||||||
# include <process.h>
|
# include <process.h>
|
||||||
# include <sys/neutrino.h>
|
# include <sys/neutrino.h>
|
||||||
|
#elif defined __HAIKU__
|
||||||
|
# include <kernel/OS.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
@ -86,6 +88,8 @@ TRACY_API uint32_t GetThreadHandleImpl()
|
|||||||
#elif defined __EMSCRIPTEN__
|
#elif defined __EMSCRIPTEN__
|
||||||
// Not supported, but let it compile.
|
// Not supported, but let it compile.
|
||||||
return 0;
|
return 0;
|
||||||
|
#elif defined __HAIKU__
|
||||||
|
return find_thread(0);
|
||||||
#else
|
#else
|
||||||
// To add support for a platform, retrieve and return the kernel thread identifier here.
|
// To add support for a platform, retrieve and return the kernel thread identifier here.
|
||||||
//
|
//
|
||||||
@ -196,6 +200,8 @@ TRACY_API void SetThreadName( const char* name )
|
|||||||
pthread_setname_np( pthread_self(), buf );
|
pthread_setname_np( pthread_self(), buf );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
#elif defined __HAIKU__
|
||||||
|
rename_thread(find_thread(0), name);
|
||||||
#endif
|
#endif
|
||||||
#ifdef TRACY_ENABLE
|
#ifdef TRACY_ENABLE
|
||||||
{
|
{
|
||||||
@ -280,6 +286,10 @@ TRACY_API const char* GetThreadName( uint32_t id )
|
|||||||
if (pthread_getname_np(static_cast<int>(id), qnxNameBuf, _NTO_THREAD_NAME_MAX) == 0) {
|
if (pthread_getname_np(static_cast<int>(id), qnxNameBuf, _NTO_THREAD_NAME_MAX) == 0) {
|
||||||
return qnxNameBuf;
|
return qnxNameBuf;
|
||||||
};
|
};
|
||||||
|
#elif defined __HAIKU__
|
||||||
|
thread_info ti;
|
||||||
|
get_thread_info(find_thread(NULL), &ti);
|
||||||
|
snprintf(buf, sizeof(buf), "%s", ti.name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sprintf( buf, "%" PRIu32, id );
|
sprintf( buf, "%" PRIu32, id );
|
||||||
|
|||||||
@ -3,6 +3,12 @@
|
|||||||
// include __WORDSIZE headers for musl
|
// include __WORDSIZE headers for musl
|
||||||
# include <bits/reg.h>
|
# include <bits/reg.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __HAIKU__
|
||||||
|
# include <config/HaikuConfig.h>
|
||||||
|
# define __WORDSIZE __HAIKU_ARCH_BITS
|
||||||
|
#endif
|
||||||
|
|
||||||
#if __WORDSIZE == 64
|
#if __WORDSIZE == 64
|
||||||
# define BACKTRACE_ELF_SIZE 64
|
# define BACKTRACE_ELF_SIZE 64
|
||||||
#else
|
#else
|
||||||
|
|||||||
@ -71,6 +71,10 @@ POSSIBILITY OF SUCH DAMAGE. */
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __HAIKU__
|
||||||
|
# define ElfW(x) Elf_##x
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
# define stat64 _stat64
|
# define stat64 _stat64
|
||||||
#endif
|
#endif
|
||||||
#if defined __APPLE__ || defined __FreeBSD__
|
#if defined __APPLE__ || defined __FreeBSD__ || defined __HAIKU__
|
||||||
# define stat64 stat
|
# define stat64 stat
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,8 @@
|
|||||||
#elif defined __APPLE__ || defined BSD
|
#elif defined __APPLE__ || defined BSD
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
# include <sys/sysctl.h>
|
# include <sys/sysctl.h>
|
||||||
|
#elif defined __HAIKU__
|
||||||
|
# include <kernel/OS.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "IconsFontAwesome6.h"
|
#include "IconsFontAwesome6.h"
|
||||||
@ -141,6 +143,10 @@ void View::InitMemory()
|
|||||||
size_t sz = sizeof( memSize );
|
size_t sz = sizeof( memSize );
|
||||||
sysctlbyname( "hw.physmem", &memSize, &sz, nullptr, 0 );
|
sysctlbyname( "hw.physmem", &memSize, &sz, nullptr, 0 );
|
||||||
m_totalMemory = memSize;
|
m_totalMemory = memSize;
|
||||||
|
#elif defined __HAIKU__
|
||||||
|
system_info sysInfo;
|
||||||
|
get_system_info(&sysInfo);
|
||||||
|
m_totalMemory = sysInfo.max_pages * PAGESIZE;
|
||||||
#else
|
#else
|
||||||
m_totalMemory = 0;
|
m_totalMemory = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -17,7 +17,7 @@ void OpenWebpage( const char* url )
|
|||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
ShellExecuteA( nullptr, nullptr, url, nullptr, nullptr, 0 );
|
ShellExecuteA( nullptr, nullptr, url, nullptr, nullptr, 0 );
|
||||||
#elif defined __APPLE__
|
#elif defined __APPLE__ || defined __HAIKU__
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
sprintf( buf, "open %s", url );
|
sprintf( buf, "open %s", url );
|
||||||
system( buf );
|
system( buf );
|
||||||
|
|||||||
@ -3,7 +3,12 @@ CFLAGS := $(OPTFLAGS) -Wall -DTRACY_ENABLE
|
|||||||
CXXFLAGS := $(CFLAGS) -std=gnu++11
|
CXXFLAGS := $(CFLAGS) -std=gnu++11
|
||||||
DEFINES +=
|
DEFINES +=
|
||||||
INCLUDES := -I../public/tracy
|
INCLUDES := -I../public/tracy
|
||||||
LIBS := -lpthread -ldl
|
LIBS := -lpthread
|
||||||
|
ifeq ($(shell uname -o),Haiku)
|
||||||
|
LIBS += -lroot -lnetwork -lbsd
|
||||||
|
else
|
||||||
|
LIBS += -ldl
|
||||||
|
endif
|
||||||
LDFLAGS := -rdynamic
|
LDFLAGS := -rdynamic
|
||||||
IMAGE := tracy_test
|
IMAGE := tracy_test
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#include "OfflineSymbolResolver.h"
|
#include "OfflineSymbolResolver.h"
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#if defined __APPLE__ || defined __HAIKU__
|
||||||
# define ftello64(x) ftello(x)
|
# define ftello64(x) ftello(x)
|
||||||
#elif defined _WIN32
|
#elif defined _WIN32
|
||||||
# define ftello64(x) _ftelli64(x)
|
# define ftello64(x) _ftelli64(x)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user