mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-08-29 21:41:03 +00:00
Improve support for high-resolution stats
* This patch adds a new microsecond-resolution function call, LiGetMicroseconds(), to complement the existing LiGetMillis(). Many variables used by stats have been updated to work at this higher resolution and now provide better results when displaying e.g. sub-millisecond frametime stats. To try and avoid confusion, variables that now contain microseconds have been renamed with a suffix of 'Us', and those ending in 'Ms' contain milliseconds. I originally experimented with nanoseconds but it felt like overkill for our needs. Public API in Limelight.h: uint64_t LiGetMicroseconds(void); uint64_t LiGetMillis(void); const RTP_AUDIO_STATS* LiGetRTPAudioStats(void); // provides access to RTP data for the overlay stats const RTP_VIDEO_STATS* LiGetRTPVideoStats(void); Note: Users of this library may need to make changes. If using LiGetMillis() to track the duration of something that is shown to the user, consider switching to LiGetMicroseconds(). Remember to divide by 1000 at time of display to show in milliseconds.
This commit is contained in:
committed by
Cameron Gutman
parent
5f2280183c
commit
82ee2d6590
+32
-2
@@ -2,6 +2,7 @@
|
||||
cmake_minimum_required(VERSION 3.1...4.0)
|
||||
project(moonlight-common-c LANGUAGES C)
|
||||
|
||||
string(TOUPPER "x${CMAKE_BUILD_TYPE}" BUILD_TYPE)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
|
||||
option(USE_MBEDTLS "Use MbedTLS instead of OpenSSL" OFF)
|
||||
@@ -61,7 +62,6 @@ else()
|
||||
target_include_directories(moonlight-common-c SYSTEM PRIVATE ${OPENSSL_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
string(TOUPPER "x${CMAKE_BUILD_TYPE}" BUILD_TYPE)
|
||||
if("${BUILD_TYPE}" STREQUAL "XDEBUG")
|
||||
target_compile_definitions(moonlight-common-c PRIVATE LC_DEBUG)
|
||||
else()
|
||||
@@ -74,10 +74,40 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT(MSVC OR APPLE))
|
||||
include(CheckLibraryExists)
|
||||
CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_CLOCK_GETTIME)
|
||||
|
||||
if (NOT HAVE_CLOCK_GETTIME)
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES time.h)
|
||||
CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME)
|
||||
SET(CMAKE_EXTRA_INCLUDE_FILES)
|
||||
endif()
|
||||
|
||||
foreach(clock CLOCK_MONOTONIC CLOCK_MONOTONIC_RAW)
|
||||
message(STATUS "Testing whether ${clock} can be used")
|
||||
CHECK_CXX_SOURCE_COMPILES(
|
||||
"#define _POSIX_C_SOURCE 200112L
|
||||
#include <time.h>
|
||||
int main ()
|
||||
{
|
||||
struct timespec ts[1];
|
||||
clock_gettime (${clock}, ts);
|
||||
return 0;
|
||||
}" HAVE_${clock})
|
||||
if(HAVE_${clock})
|
||||
message(STATUS "Testing whether ${clock} can be used -- Success")
|
||||
else()
|
||||
message(STATUS "Testing whether ${clock} can be used -- Failed")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
endif()
|
||||
|
||||
target_include_directories(moonlight-common-c SYSTEM PUBLIC src)
|
||||
|
||||
target_include_directories(moonlight-common-c PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/reedsolomon
|
||||
)
|
||||
|
||||
target_compile_definitions(moonlight-common-c PRIVATE HAS_SOCKLEN_T)
|
||||
target_compile_definitions(moonlight-common-c PRIVATE HAS_SOCKLEN_T)
|
||||
|
||||
Reference in New Issue
Block a user