Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wolfpld/tracy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorBartosz Taudul <wolf@nereid.pl>2022-08-18 14:18:39 +0300
committerBartosz Taudul <wolf@nereid.pl>2022-08-18 14:18:39 +0300
commit1d60c0cd5bc4509852c6729cb77bc012e5eda0aa (patch)
tree43e6c6dfa2f0319d7ba2b71d549b6088a85837b7 /extra
parent07a56f1148f8ef605bff62ae9903d95a4a1b0ef2 (diff)
Remove leftovers.
Diffstat (limited to 'extra')
-rwxr-xr-xextra/systrace/build.sh31
-rw-r--r--extra/systrace/tracy_systrace.c65
2 files changed, 0 insertions, 96 deletions
diff --git a/extra/systrace/build.sh b/extra/systrace/build.sh
deleted file mode 100755
index 1da097a9..00000000
--- a/extra/systrace/build.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/sh
-
-# These may be passed as environment variables, or will use the following defaults.
-: ${CC:=clang}
-: ${STRIP:=strip}
-: ${SSTRIP:=sstrip}
-
-if [ ! -x "$(command -v "${CC}")" ]
-then
- echo "Set the CC environment variable to a C compiler."
- exit 1
-fi
-
-if [ ! -x "$(command -v "${STRIP}")" ]
-then
- echo "Set the STRIP environment variable to the strip utility."
- exit 1
-fi
-
-if [ ! -x "$(command -v "${SSTRIP}")" ]
-then
- echo "Set the SSTRIP environment variable to the sstrip utility, which can be obtained from https://github.com/BR903/ELFkickers ."
- exit 1
-fi
-
-$CC tracy_systrace.c -s -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -fno-stack-protector -Wl,-z,norelro -Wl,--build-id=none -nostdlib -ldl -o tracy_systrace
-
-$STRIP --strip-all -R .note.gnu.gold-version -R .comment -R .note -R .note.gnu.build-id -R .note.ABI-tag -R .eh_frame -R .eh_frame_hdr -R .gnu.version -R .got tracy_systrace
-
-$SSTRIP -z tracy_systrace
-
diff --git a/extra/systrace/tracy_systrace.c b/extra/systrace/tracy_systrace.c
deleted file mode 100644
index 58fcbfe8..00000000
--- a/extra/systrace/tracy_systrace.c
+++ /dev/null
@@ -1,65 +0,0 @@
-#include <fcntl.h>
-#include <poll.h>
-#include <stdio.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <time.h>
-#include <unistd.h>
-#include <dlfcn.h>
-
-enum { BufSize = 64*1024 };
-
-typedef int (*open_t)( const char*, int, ... );
-typedef void (*exit_t)( int );
-typedef int (*poll_t)( struct pollfd*, nfds_t, int timeout );
-typedef int (*nanosleep_t)( const struct timespec*, struct timespec* );
-typedef ssize_t (*read_t)( int, void*, size_t );
-typedef ssize_t (*write_t)( int, const void*, size_t );
-
-void _start()
-{
- void* libc = dlopen( "libc.so", RTLD_LAZY );
-
- open_t sym_open = dlsym( libc, "open" );
- exit_t sym_exit = dlsym( libc, "exit" );
- poll_t sym_poll = dlsym( libc, "poll" );
- nanosleep_t sym_nanosleep = dlsym( libc, "nanosleep" );
- read_t sym_read = dlsym( libc, "read" );
- write_t sym_write = dlsym( libc, "write" );
-
- char buf[BufSize];
-
- int kernelFd = sym_open( "/sys/kernel/debug/tracing/trace_pipe", O_RDONLY );
- if( kernelFd < 0 ) sym_exit( 0 );
-
- struct pollfd pfd_in;
- pfd_in.fd = kernelFd;
- pfd_in.events = POLLIN | POLLERR;
-
- struct pollfd pfd_out;
- pfd_out.fd = STDOUT_FILENO;
- pfd_out.events = POLLERR;
-
- struct timespec sleepTime;
- sleepTime.tv_sec = 0;
- sleepTime.tv_nsec = 1000 * 1000 * 10;
-
- // While the pipe is open (no POLLERR on the output fd)
- while( sym_poll( &pfd_out, 1, 0) <= 0 )
- {
- // If there is neither data (POLLIN) nor an error (POLLERR) on
- // the read fd, sleep. This implements a blocking read without relying
- // on the Linux kernel's implementation of blocking reads which causes
- // a large number of context switches.
- if( sym_poll( &pfd_in, 1, 0 ) <= 0 ) {
- sym_nanosleep( &sleepTime, NULL );
- continue; // go back to the while condition polling the output fd
- }
- const ssize_t rd = sym_read( kernelFd, buf, BufSize );
- if( rd <= 0 ) break;
- sym_write( STDOUT_FILENO, buf, rd );
- }
-
- sym_exit( 0 );
-}