mirror of
https://github.com/ossrs/srs.git
synced 2025-02-12 19:31:53 +00:00
for #155, add todo for osx. 2.0.146
This commit is contained in:
parent
6776065b04
commit
33cca3e027
4 changed files with 51 additions and 8 deletions
|
@ -3,7 +3,7 @@ There are three types of people that have contributed to the SRS project:
|
||||||
2. AUTHORS: Contribute features and 1%~10% code. Names of all PRIMARY response in NetConnection.connect and metadata.
|
2. AUTHORS: Contribute features and 1%~10% code. Names of all PRIMARY response in NetConnection.connect and metadata.
|
||||||
3. CONTRIBUTORS: Submit patches, report bugs, add translations, help answer newbie questions, and generally make SRS that much better.
|
3. CONTRIBUTORS: Submit patches, report bugs, add translations, help answer newbie questions, and generally make SRS that much better.
|
||||||
|
|
||||||
PRIMARY ordered by first contribution.
|
PRIMARY authors ordered by first contribution.
|
||||||
* winlin<winlin@vip.126.com> "Plan, arch, implement SRS1.0 and SRS2.0"
|
* winlin<winlin@vip.126.com> "Plan, arch, implement SRS1.0 and SRS2.0"
|
||||||
|
|
||||||
AUTHORS ordered by first contribution.
|
AUTHORS ordered by first contribution.
|
||||||
|
|
|
@ -836,7 +836,6 @@ int SrsServer::do_cycle()
|
||||||
srs_info("update resource info, rss.");
|
srs_info("update resource info, rss.");
|
||||||
srs_update_system_rusage();
|
srs_update_system_rusage();
|
||||||
}
|
}
|
||||||
#ifndef SRS_OSX
|
|
||||||
if ((i % SRS_SYS_CPU_STAT_RESOLUTION_TIMES) == 0) {
|
if ((i % SRS_SYS_CPU_STAT_RESOLUTION_TIMES) == 0) {
|
||||||
srs_info("update cpu info, cpu usage.");
|
srs_info("update cpu info, cpu usage.");
|
||||||
srs_update_proc_stat();
|
srs_update_proc_stat();
|
||||||
|
@ -849,12 +848,10 @@ int SrsServer::do_cycle()
|
||||||
srs_info("update memory info, usage/free.");
|
srs_info("update memory info, usage/free.");
|
||||||
srs_update_meminfo();
|
srs_update_meminfo();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if ((i % SRS_SYS_PLATFORM_INFO_RESOLUTION_TIMES) == 0) {
|
if ((i % SRS_SYS_PLATFORM_INFO_RESOLUTION_TIMES) == 0) {
|
||||||
srs_info("update platform info, uptime/load.");
|
srs_info("update platform info, uptime/load.");
|
||||||
srs_update_platform_info();
|
srs_update_platform_info();
|
||||||
}
|
}
|
||||||
#ifndef SRS_OSX
|
|
||||||
if ((i % SRS_SYS_NETWORK_DEVICE_RESOLUTION_TIMES) == 0) {
|
if ((i % SRS_SYS_NETWORK_DEVICE_RESOLUTION_TIMES) == 0) {
|
||||||
srs_info("update network devices info.");
|
srs_info("update network devices info.");
|
||||||
srs_update_network_devices();
|
srs_update_network_devices();
|
||||||
|
@ -871,7 +868,6 @@ int SrsServer::do_cycle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
srs_info("server main thread loop");
|
srs_info("server main thread loop");
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,6 +225,7 @@ SrsProcSystemStat* srs_get_system_proc_stat()
|
||||||
|
|
||||||
bool get_proc_system_stat(SrsProcSystemStat& r)
|
bool get_proc_system_stat(SrsProcSystemStat& r)
|
||||||
{
|
{
|
||||||
|
#ifndef SRS_OSX
|
||||||
FILE* f = fopen("/proc/stat", "r");
|
FILE* f = fopen("/proc/stat", "r");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
srs_warn("open system cpu stat failed, ignore");
|
srs_warn("open system cpu stat failed, ignore");
|
||||||
|
@ -254,6 +255,10 @@ bool get_proc_system_stat(SrsProcSystemStat& r)
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
#else
|
||||||
|
// TODO: FIXME: impelments it.
|
||||||
|
// Fuck all of you who use osx for a long time and never patch the osx features for srs.
|
||||||
|
#endif
|
||||||
|
|
||||||
r.ok = true;
|
r.ok = true;
|
||||||
|
|
||||||
|
@ -262,6 +267,7 @@ bool get_proc_system_stat(SrsProcSystemStat& r)
|
||||||
|
|
||||||
bool get_proc_self_stat(SrsProcSelfStat& r)
|
bool get_proc_self_stat(SrsProcSelfStat& r)
|
||||||
{
|
{
|
||||||
|
#ifndef SRS_OSX
|
||||||
FILE* f = fopen("/proc/self/stat", "r");
|
FILE* f = fopen("/proc/self/stat", "r");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
srs_warn("open self cpu stat failed, ignore");
|
srs_warn("open self cpu stat failed, ignore");
|
||||||
|
@ -288,6 +294,10 @@ bool get_proc_self_stat(SrsProcSelfStat& r)
|
||||||
&r.guest_time, &r.cguest_time);
|
&r.guest_time, &r.cguest_time);
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
#else
|
||||||
|
// TODO: FIXME: impelments it.
|
||||||
|
// Fuck all of you who use osx for a long time and never patch the osx features for srs.
|
||||||
|
#endif
|
||||||
|
|
||||||
r.ok = true;
|
r.ok = true;
|
||||||
|
|
||||||
|
@ -385,6 +395,7 @@ SrsDiskStat* srs_get_disk_stat()
|
||||||
|
|
||||||
bool srs_get_disk_vmstat_stat(SrsDiskStat& r)
|
bool srs_get_disk_vmstat_stat(SrsDiskStat& r)
|
||||||
{
|
{
|
||||||
|
#ifndef SRS_OSX
|
||||||
FILE* f = fopen("/proc/vmstat", "r");
|
FILE* f = fopen("/proc/vmstat", "r");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
srs_warn("open vmstat failed, ignore");
|
srs_warn("open vmstat failed, ignore");
|
||||||
|
@ -404,6 +415,10 @@ bool srs_get_disk_vmstat_stat(SrsDiskStat& r)
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
#else
|
||||||
|
// TODO: FIXME: impelments it.
|
||||||
|
// Fuck all of you who use osx for a long time and never patch the osx features for srs.
|
||||||
|
#endif
|
||||||
|
|
||||||
r.ok = true;
|
r.ok = true;
|
||||||
|
|
||||||
|
@ -421,6 +436,7 @@ bool srs_get_disk_diskstats_stat(SrsDiskStat& r)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SRS_OSX
|
||||||
FILE* f = fopen("/proc/diskstats", "r");
|
FILE* f = fopen("/proc/diskstats", "r");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
srs_warn("open vmstat failed, ignore");
|
srs_warn("open vmstat failed, ignore");
|
||||||
|
@ -485,6 +501,10 @@ bool srs_get_disk_diskstats_stat(SrsDiskStat& r)
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
#else
|
||||||
|
// TODO: FIXME: impelments it.
|
||||||
|
// Fuck all of you who use osx for a long time and never patch the osx features for srs.
|
||||||
|
#endif
|
||||||
|
|
||||||
r.ok = true;
|
r.ok = true;
|
||||||
|
|
||||||
|
@ -575,14 +595,15 @@ SrsMemInfo* srs_get_meminfo()
|
||||||
|
|
||||||
void srs_update_meminfo()
|
void srs_update_meminfo()
|
||||||
{
|
{
|
||||||
|
SrsMemInfo& r = _srs_system_meminfo;
|
||||||
|
|
||||||
|
#ifndef SRS_OSX
|
||||||
FILE* f = fopen("/proc/meminfo", "r");
|
FILE* f = fopen("/proc/meminfo", "r");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
srs_warn("open meminfo failed, ignore");
|
srs_warn("open meminfo failed, ignore");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsMemInfo& r = _srs_system_meminfo;
|
|
||||||
|
|
||||||
static char buf[1024];
|
static char buf[1024];
|
||||||
while (fgets(buf, sizeof(buf), f)) {
|
while (fgets(buf, sizeof(buf), f)) {
|
||||||
// @see: read_meminfo() from https://github.com/sysstat/sysstat/blob/master/rd_stats.c#L227
|
// @see: read_meminfo() from https://github.com/sysstat/sysstat/blob/master/rd_stats.c#L227
|
||||||
|
@ -602,6 +623,10 @@ void srs_update_meminfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
#else
|
||||||
|
// TODO: FIXME: impelments it.
|
||||||
|
// Fuck all of you who use osx for a long time and never patch the osx features for srs.
|
||||||
|
#endif
|
||||||
|
|
||||||
r.sample_time = srs_get_system_time_ms();
|
r.sample_time = srs_get_system_time_ms();
|
||||||
r.MemActive = r.MemTotal - r.MemFree;
|
r.MemActive = r.MemTotal - r.MemFree;
|
||||||
|
@ -781,6 +806,7 @@ int srs_get_network_devices_count()
|
||||||
|
|
||||||
void srs_update_network_devices()
|
void srs_update_network_devices()
|
||||||
{
|
{
|
||||||
|
#ifndef SRS_OSX
|
||||||
if (true) {
|
if (true) {
|
||||||
FILE* f = fopen("/proc/net/dev", "r");
|
FILE* f = fopen("/proc/net/dev", "r");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
|
@ -815,6 +841,10 @@ void srs_update_network_devices()
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
// TODO: FIXME: impelments it.
|
||||||
|
// Fuck all of you who use osx for a long time and never patch the osx features for srs.
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsNetworkRtmpServer::SrsNetworkRtmpServer()
|
SrsNetworkRtmpServer::SrsNetworkRtmpServer()
|
||||||
|
@ -862,6 +892,7 @@ void srs_update_rtmp_server(int nb_conn, SrsKbps* kbps)
|
||||||
int nb_tcp_mem = 0;
|
int nb_tcp_mem = 0;
|
||||||
int nb_udp4 = 0;
|
int nb_udp4 = 0;
|
||||||
|
|
||||||
|
#ifndef SRS_OSX
|
||||||
if (true) {
|
if (true) {
|
||||||
FILE* f = fopen("/proc/net/sockstat", "r");
|
FILE* f = fopen("/proc/net/sockstat", "r");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
|
@ -891,9 +922,21 @@ void srs_update_rtmp_server(int nb_conn, SrsKbps* kbps)
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
// TODO: FIXME: impelments it.
|
||||||
|
// Fuck all of you who use osx for a long time and never patch the osx features for srs.
|
||||||
|
nb_socks = 0;
|
||||||
|
nb_tcp4_hashed = 0;
|
||||||
|
nb_tcp_orphans = 0;
|
||||||
|
nb_tcp_tws = 0;
|
||||||
|
nb_tcp_total = 0;
|
||||||
|
nb_tcp_mem = 0;
|
||||||
|
nb_udp4 = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
int nb_tcp_estab = 0;
|
int nb_tcp_estab = 0;
|
||||||
|
|
||||||
|
#ifndef SRS_OSX
|
||||||
if (true) {
|
if (true) {
|
||||||
FILE* f = fopen("/proc/net/snmp", "r");
|
FILE* f = fopen("/proc/net/snmp", "r");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
|
@ -923,6 +966,10 @@ void srs_update_rtmp_server(int nb_conn, SrsKbps* kbps)
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
// TODO: FIXME: impelments it.
|
||||||
|
// Fuck all of you who use osx for a long time and never patch the osx features for srs.
|
||||||
|
#endif
|
||||||
|
|
||||||
// @see: https://github.com/shemminger/iproute2/blob/master/misc/ss.c
|
// @see: https://github.com/shemminger/iproute2/blob/master/misc/ss.c
|
||||||
// TODO: FIXME: ignore the slabstat, @see: get_slabstat()
|
// TODO: FIXME: ignore the slabstat, @see: get_slabstat()
|
||||||
|
|
|
@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
// current release version
|
// current release version
|
||||||
#define VERSION_MAJOR 2
|
#define VERSION_MAJOR 2
|
||||||
#define VERSION_MINOR 0
|
#define VERSION_MINOR 0
|
||||||
#define VERSION_REVISION 145
|
#define VERSION_REVISION 146
|
||||||
|
|
||||||
// server info.
|
// server info.
|
||||||
#define RTMP_SIG_SRS_KEY "SRS"
|
#define RTMP_SIG_SRS_KEY "SRS"
|
||||||
|
|
Loading…
Reference in a new issue