mirror of https://github.com/mpv-player/mpv
loader: remove weird kstat thing
Apparently the win32 binary codec loader used this to retrieve the CPU frequency on Solaris.
This commit is contained in:
parent
dfbfc7e75e
commit
debca22212
|
@ -1436,18 +1436,6 @@ fi
|
||||||
echores "$_builtin_expect"
|
echores "$_builtin_expect"
|
||||||
|
|
||||||
|
|
||||||
echocheck "kstat"
|
|
||||||
_kstat=no
|
|
||||||
statement_check kstat.h 'kstat_open()' -lkstat && _kstat=yes
|
|
||||||
if test "$_kstat" = yes ; then
|
|
||||||
def_kstat="#define HAVE_LIBKSTAT 1"
|
|
||||||
extra_ldflags="$extra_ldflags -lkstat"
|
|
||||||
else
|
|
||||||
def_kstat="#undef HAVE_LIBKSTAT"
|
|
||||||
fi
|
|
||||||
echores "$_kstat"
|
|
||||||
|
|
||||||
|
|
||||||
echocheck "posix4"
|
echocheck "posix4"
|
||||||
# required for nanosleep on some systems
|
# required for nanosleep on some systems
|
||||||
_posix4=no
|
_posix4=no
|
||||||
|
@ -4216,7 +4204,6 @@ $def_builtin_expect
|
||||||
$def_dl
|
$def_dl
|
||||||
$def_dos_paths
|
$def_dos_paths
|
||||||
$def_iconv
|
$def_iconv
|
||||||
$def_kstat
|
|
||||||
$def_macosx_bundle
|
$def_macosx_bundle
|
||||||
$def_macosx_finder
|
$def_macosx_finder
|
||||||
$def_priority
|
$def_priority
|
||||||
|
|
|
@ -66,9 +66,6 @@ for DLL to know too much about its environment.
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#ifdef HAVE_KSTAT
|
|
||||||
#include <kstat.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_MMAN_H
|
#ifdef HAVE_SYS_MMAN_H
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
@ -2149,47 +2146,6 @@ static double linux_cpuinfo_freq(void)
|
||||||
return freq;
|
return freq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static double solaris_kstat_freq(void)
|
|
||||||
{
|
|
||||||
#if defined(HAVE_LIBKSTAT) && defined(KSTAT_DATA_INT32)
|
|
||||||
/*
|
|
||||||
* try to extract the CPU speed from the solaris kernel's kstat data
|
|
||||||
*/
|
|
||||||
kstat_ctl_t *kc;
|
|
||||||
kstat_t *ksp;
|
|
||||||
kstat_named_t *kdata;
|
|
||||||
int mhz = 0;
|
|
||||||
|
|
||||||
kc = kstat_open();
|
|
||||||
if (kc != NULL)
|
|
||||||
{
|
|
||||||
ksp = kstat_lookup(kc, "cpu_info", 0, "cpu_info0");
|
|
||||||
|
|
||||||
/* kstat found and name/value pairs? */
|
|
||||||
if (ksp != NULL && ksp->ks_type == KSTAT_TYPE_NAMED)
|
|
||||||
{
|
|
||||||
/* read the kstat data from the kernel */
|
|
||||||
if (kstat_read(kc, ksp, NULL) != -1)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* lookup desired "clock_MHz" entry, check the expected
|
|
||||||
* data type
|
|
||||||
*/
|
|
||||||
kdata = (kstat_named_t *)kstat_data_lookup(ksp, "clock_MHz");
|
|
||||||
if (kdata != NULL && kdata->data_type == KSTAT_DATA_INT32)
|
|
||||||
mhz = kdata->value.i32;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
kstat_close(kc);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mhz > 0)
|
|
||||||
return mhz * 1000.;
|
|
||||||
#endif /* HAVE_LIBKSTAT */
|
|
||||||
return -1; // kstat stuff is not available, CPU freq is unknown
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Measure CPU freq using the pentium's time stamp counter register (TSC)
|
* Measure CPU freq using the pentium's time stamp counter register (TSC)
|
||||||
*/
|
*/
|
||||||
|
@ -2216,9 +2172,6 @@ static double CPU_Freq(void)
|
||||||
if ((freq = linux_cpuinfo_freq()) > 0)
|
if ((freq = linux_cpuinfo_freq()) > 0)
|
||||||
return freq;
|
return freq;
|
||||||
|
|
||||||
if ((freq = solaris_kstat_freq()) > 0)
|
|
||||||
return freq;
|
|
||||||
|
|
||||||
return tsc_freq();
|
return tsc_freq();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue