From 0b8cc39f9cc4b9a009fbfbd92bda2dfae1123762 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Tue, 16 Aug 2022 10:38:44 +0200 Subject: [PATCH] removed perf tool It was almost never used since added. --- Makefile.in | 6 --- src/audio/audio.cpp | 1 - src/host.cpp | 4 -- src/perf.c | 85 ----------------------------- src/perf.h | 84 ----------------------------- src/rtp/audio_decoders.cpp | 1 - src/rtp/pbuf.c | 4 -- src/rtp/rtpdec_h264.c | 1 - src/rtp/video_decoders.cpp | 3 -- src/transmit.cpp | 4 -- src/uv_perf.c | 107 ------------------------------------- src/video_display.c | 3 -- 12 files changed, 303 deletions(-) delete mode 100644 src/perf.c delete mode 100644 src/perf.h delete mode 100644 src/uv_perf.c diff --git a/Makefile.in b/Makefile.in index d8b8dc149..a0576e876 100644 --- a/Makefile.in +++ b/Makefile.in @@ -38,7 +38,6 @@ DYLIBBUNDLER = @DYLIBBUNDLER@ DYLIBBUNDLER_FLAGS += @DYLIBBUNDLER_FLAGS@ EXEEXT = @EXEEXT@ TARGET = bin/uv$(EXEEXT) -PERF = bin/uv_perf BUNDLE = uv.app GUI_BUNDLE = gui/QT/uv-qt.app DXT_GLSL_CFLAGS = @DXT_GLSL_CFLAGS@ @@ -83,7 +82,6 @@ COMMON_OBJS = \ src/host.o \ src/keyboard_control.o \ src/messaging.o \ - src/perf.o \ src/playback.o \ src/ntp.o \ src/pdb.o \ @@ -580,7 +578,6 @@ clean: $(COND_SILENCE)-rm -f data/ag_plugin/uvReceiverService.zip data/ag_plugin/uvSenderService.zip $(COND_SILENCE)-rm -rf $(BUNDLE) $(COND_SILENCE)-rm -rf $(GUI_BUNDLE) - $(COND_SILENCE)-rm -rf $(PERF) src/uv_perf.o $(COND_SILENCE)-rm -rf $(REFLECTOR_TARGET) $(REFLECTOR_OBJS) $(COND_SILENCE)-rm -rf @LIB_OBJS@ @MODULES@ @LIB_GENERATED_HEADERS@ $(COND_SILENCE)-rm -rf $(DEP_FILES) @@ -674,9 +671,6 @@ osx-gui-dmg: [ ! -f UltraGrid.dmg ] || rm UltraGrid.dmg hdiutil create -fs HFS+ -volname ULTRAGRID -srcdir $(GUI_BUNDLE) -format UDZO -imagekey zlib-level=9 -o UltraGrid.dmg -perf: src/tv.o src/crypto/random.o - $(CC) $(CFLAGS) -DPERF src/uv_perf.c src/crypto/random.o src/tv.o -o $(PERF) - @TARGETS@ install: all diff --git a/src/audio/audio.cpp b/src/audio/audio.cpp index fcb49eb4f..50a883a62 100644 --- a/src/audio/audio.cpp +++ b/src/audio/audio.cpp @@ -78,7 +78,6 @@ #include "../export.h" // not audio/export.h #include "host.h" #include "module.h" -#include "perf.h" #include "rang.hpp" #include "rtp/audio_decoders.h" #include "rtp/fec.h" diff --git a/src/host.cpp b/src/host.cpp index 60a1d6f72..04d32d1ce 100644 --- a/src/host.cpp +++ b/src/host.cpp @@ -58,7 +58,6 @@ #include "lib_common.h" #include "messaging.h" #include "module.h" -#include "perf.h" #include "rang.hpp" #include "utils/color_out.h" // unit_evaluate #include "utils/misc.h" // unit_evaluate @@ -422,9 +421,6 @@ struct init_data *common_preinit(int argc, char *argv[]) mtrace(); #endif - perf_init(); - perf_record(UVP_INIT, 0); - load_libgcc(); return init; diff --git a/src/perf.c b/src/perf.c deleted file mode 100644 index b69de6e36..000000000 --- a/src/perf.c +++ /dev/null @@ -1,85 +0,0 @@ -/** - * @file perf.c - * @author Martin Pulec - */ -/* - * Copyright (c) 2011 CESNET, z. s. p. o. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of CESNET nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if defined PERF && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) - -#include "config.h" -#include "config_unix.h" -#include "config_win32.h" -#include "debug.h" -#include "perf.h" - -#include -#include -#include -#include - -static volatile size_t _uvp_offset; -static int _uvp_id; -static char *_uvp_shm; - -void perf_init() -{ - _uvp_id = shmget(_uvp_key, BUFFER_LEN, IPC_CREAT | 0666); - _uvp_shm = shmat(_uvp_id, NULL, 0); - _uvp_offset = 0; -} - -void perf_record(_uvp_event_t event, _uvp_arg_t arg) -{ - size_t current; - struct timeval tv; - char *ptr; - - gettimeofday(&tv, NULL); - current = __sync_fetch_and_add(&_uvp_offset, ENTRY_LEN); - if(current == BUFFER_LEN) - { - _uvp_offset = 0; - current = 0; - } else if (current > BUFFER_LEN) { - while((current = __sync_fetch_and_add(&_uvp_offset, ENTRY_LEN)) > BUFFER_LEN) - ; - } - ptr = _uvp_shm + current; - ((struct _uvp_entry *) ptr)->tv_sec = tv.tv_sec; - ((struct _uvp_entry *) ptr)->tv_usec = tv.tv_usec; - ((struct _uvp_entry *) ptr)->event = event; - ((struct _uvp_entry *) ptr)->arg = arg; -} - -#endif /* PERF && __GNUC__ */ diff --git a/src/perf.h b/src/perf.h deleted file mode 100644 index dd0059af6..000000000 --- a/src/perf.h +++ /dev/null @@ -1,84 +0,0 @@ -/** - * @file perf. - * @author Martin Pulec - */ -/* - * Copyright (c) 2011 CESNET, z. s. p. o. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of CESNET nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _PERF_H -#define _PERF_H - - -#include "config.h" -#include "config_unix.h" -#include "config_win32.h" - -/* Public API */ -#define UVP_INIT 1 -#define UVP_GETFRAME 2 -#define UVP_PUTFRAME 3 -#define UVP_DECODEFRAME 4 -#define UVP_SEND 5 -#define UVP_CREATEPBUF 6 - -#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && defined PERF - -typedef uint32_t _uvp_event_t; -typedef int64_t _uvp_arg_t; - -void perf_init(void); - -/* Private section */ -struct _uvp_entry { - long int tv_sec; - long int tv_usec; - _uvp_event_t event; - _uvp_arg_t arg; -}; - -#define ENTRY_LEN sizeof(struct _uvp_entry) -#define BUFFER_LEN (ENTRY_LEN * 512) - -static key_t _uvp_key = 5043; - -void perf_record(_uvp_event_t event, _uvp_arg_t arg); - -#else - -#define perf_record(x,y) {} -#define perf_init() {} - -#endif /* __GNUC__ && PERF */ - -#endif /* _PERF_H */ - diff --git a/src/rtp/audio_decoders.cpp b/src/rtp/audio_decoders.cpp index 2f50eedc8..32dd4e183 100644 --- a/src/rtp/audio_decoders.cpp +++ b/src/rtp/audio_decoders.cpp @@ -48,7 +48,6 @@ #include "host.h" #include "lib_common.h" #include "module.h" -#include "perf.h" #include "tv.h" #include "rtp/fec.h" #include "rtp/rtp.h" diff --git a/src/rtp/pbuf.c b/src/rtp/pbuf.c index 32fb839ba..696f6b840 100644 --- a/src/rtp/pbuf.c +++ b/src/rtp/pbuf.c @@ -60,7 +60,6 @@ #include #include "debug.h" -#include "perf.h" #include "rtp/rtp.h" #include "rtp/rtp_callback.h" #include "rtp/ptime.h" @@ -276,9 +275,6 @@ static void add_coded_unit(struct pbuf_node *node, rtp_packet * pkt) static struct pbuf_node *create_new_pnode(rtp_packet * pkt, long long playout_delay_us) { - - perf_record(UVP_CREATEPBUF, pkt->ts); - struct pbuf_node *tmp = calloc(1, sizeof(struct pbuf_node)); if (tmp != NULL) { tmp->magic = PBUF_MAGIC; diff --git a/src/rtp/rtpdec_h264.c b/src/rtp/rtpdec_h264.c index 8244c24fc..456075e85 100644 --- a/src/rtp/rtpdec_h264.c +++ b/src/rtp/rtpdec_h264.c @@ -47,7 +47,6 @@ #endif // HAVE_CONFIG_H #include "debug.h" -#include "perf.h" #include "rtp/rtp.h" #include "rtp/rtp_callback.h" #include "rtp/pbuf.h" diff --git a/src/rtp/video_decoders.cpp b/src/rtp/video_decoders.cpp index 28e08b098..7c261531d 100644 --- a/src/rtp/video_decoders.cpp +++ b/src/rtp/video_decoders.cpp @@ -107,7 +107,6 @@ #include "lib_common.h" #include "messaging.h" #include "module.h" -#include "perf.h" #include "rang.hpp" #include "rtp/fec.h" #include "rtp/rtp.h" @@ -1513,8 +1512,6 @@ int decode_video_frame(struct coded_data *cdata, void *decoder_data, struct pbuf int pt = 0; bool buffer_swapped = false; - perf_record(UVP_DECODEFRAME, cdata); - // We have no framebuffer assigned, exitting if(!decoder->display) { vf_free(frame); diff --git a/src/transmit.cpp b/src/transmit.cpp index aeeb305d0..290a650de 100644 --- a/src/transmit.cpp +++ b/src/transmit.cpp @@ -69,7 +69,6 @@ #include "debug.h" #include "host.h" #include "lib_common.h" -#include "perf.h" #include "crypto/openssl_encrypt.h" #include "module.h" #include "rang.hpp" @@ -633,8 +632,6 @@ tx_send_base(struct tx *tx, struct video_frame *frame, struct rtp *rtp_session, tx_update(tx, frame, substream); - perf_record(UVP_SEND, ts); - if (frame->fec_params.type == FEC_NONE) { hdrs_len += (sizeof(video_payload_hdr_t)); rtp_hdr_len = sizeof(video_payload_hdr_t); @@ -776,7 +773,6 @@ void audio_tx_send(struct tx* tx, struct rtp *rtp_session, const audio_frame2 * fec_check_messages(tx); timestamp = get_local_mediatime(); - perf_record(UVP_SEND, timestamp); for (int channel = 0; channel < buffer->get_channel_count(); ++channel) { diff --git a/src/uv_perf.c b/src/uv_perf.c deleted file mode 100644 index 0ab0bc67c..000000000 --- a/src/uv_perf.c +++ /dev/null @@ -1,107 +0,0 @@ -/** - * @file uv_perf.c - * @author Martin Pulec - */ -/* - * Copyright (c) 2011-2012 CESNET, z. s. p. o. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of CESNET nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "config_unix.h" -#include "config_win32.h" -#include "debug.h" -#include "perf.h" - -#include -#include -#include -#include -#include -#include - -struct message { - const char * msg; - const char * argtype; -}; - -static const struct message messages[] = { - [UVP_INIT] = { "Profiling tool initialized", "" }, - [UVP_GETFRAME] = { "Frame get", "display address" }, - [UVP_PUTFRAME] = { "Frame put", "frame address (UNUSED!)" }, - [UVP_DECODEFRAME] = { "Decode frame", "frame address" }, - [UVP_SEND] = { "TX Send", "timestamp" }, - [UVP_CREATEPBUF] = { "RX Received (first packet)", "timestamp" }, -}; - -int main(int argc, char *argv[]) -{ - int id; - volatile struct _uvp_entry *shm; - volatile struct _uvp_entry *tmp; - struct timeval tv_old; - struct timeval tv_cur; - - tv_old.tv_sec = 0; - tv_old.tv_usec = 0; - - id = shmget(_uvp_key, BUFFER_LEN, IPC_CREAT | 0666); - shm = shmat(id, NULL, 0); - tmp = shm; - - memset((char *) shm, '\0', BUFFER_LEN); - - while(1) - { - if(tmp == shm + BUFFER_LEN/ENTRY_LEN) { - tmp = shm; - } - tv_cur.tv_sec = tmp->tv_sec; - tv_cur.tv_usec = tmp->tv_usec; - if(tv_gt(tv_old, tv_cur) && tv_diff_usec(tv_old, tv_cur) > 1000) /* 0.001 sec out of order is OK */ - //tmp->tv_usec < tv_old.tv_usec) - { - usleep(100000); - continue; - } - tv_old.tv_sec = tmp->tv_sec; - tv_old.tv_usec = tmp->tv_usec; - - if(tmp->tv_sec != 0) { - printf("%10ld %10ld%30s:\t%20lX (%s)\n", tmp->tv_sec, tmp->tv_usec, messages[tmp->event].msg, tmp->arg, messages[tmp->event].argtype); - } - tmp++; - } - shmdt(shm); - - return 0; -} - diff --git a/src/video_display.c b/src/video_display.c index 145498e27..4f001dc5b 100644 --- a/src/video_display.c +++ b/src/video_display.c @@ -65,7 +65,6 @@ #include "debug.h" #include "lib_common.h" #include "module.h" -#include "perf.h" #include "tv.h" #include "utils/thread.h" #include "utils/color_out.h" @@ -343,7 +342,6 @@ struct video_frame *display_get_frame(struct display *d) free_message(msg, r); } - perf_record(UVP_GETFRAME, d); assert(d->magic == DISPLAY_MAGIC); if (d->postprocess) { return vo_postprocess_getf(d->postprocess); @@ -365,7 +363,6 @@ struct video_frame *display_get_frame(struct display *d) */ int display_put_frame(struct display *d, struct video_frame *frame, int flags) { - perf_record(UVP_PUTFRAME, frame); assert(d->magic == DISPLAY_MAGIC); if (!frame) {