winlin

for #155, add todo for osx. 2.0.146

... ... @@ -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.
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"
AUTHORS ordered by first contribution.
... ...
... ... @@ -836,7 +836,6 @@ int SrsServer::do_cycle()
srs_info("update resource info, rss.");
srs_update_system_rusage();
}
#ifndef SRS_OSX
if ((i % SRS_SYS_CPU_STAT_RESOLUTION_TIMES) == 0) {
srs_info("update cpu info, cpu usage.");
srs_update_proc_stat();
... ... @@ -849,12 +848,10 @@ int SrsServer::do_cycle()
srs_info("update memory info, usage/free.");
srs_update_meminfo();
}
#endif
if ((i % SRS_SYS_PLATFORM_INFO_RESOLUTION_TIMES) == 0) {
srs_info("update platform info, uptime/load.");
srs_update_platform_info();
}
#ifndef SRS_OSX
if ((i % SRS_SYS_NETWORK_DEVICE_RESOLUTION_TIMES) == 0) {
srs_info("update network devices info.");
srs_update_network_devices();
... ... @@ -872,7 +869,6 @@ int SrsServer::do_cycle()
}
#endif
#endif
#endif
srs_info("server main thread loop");
}
}
... ...
... ... @@ -225,6 +225,7 @@ SrsProcSystemStat* srs_get_system_proc_stat()
bool get_proc_system_stat(SrsProcSystemStat& r)
{
#ifndef SRS_OSX
FILE* f = fopen("/proc/stat", "r");
if (f == NULL) {
srs_warn("open system cpu stat failed, ignore");
... ... @@ -254,6 +255,10 @@ bool get_proc_system_stat(SrsProcSystemStat& r)
}
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;
... ... @@ -262,6 +267,7 @@ bool get_proc_system_stat(SrsProcSystemStat& r)
bool get_proc_self_stat(SrsProcSelfStat& r)
{
#ifndef SRS_OSX
FILE* f = fopen("/proc/self/stat", "r");
if (f == NULL) {
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);
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;
... ... @@ -385,6 +395,7 @@ SrsDiskStat* srs_get_disk_stat()
bool srs_get_disk_vmstat_stat(SrsDiskStat& r)
{
#ifndef SRS_OSX
FILE* f = fopen("/proc/vmstat", "r");
if (f == NULL) {
srs_warn("open vmstat failed, ignore");
... ... @@ -404,6 +415,10 @@ bool srs_get_disk_vmstat_stat(SrsDiskStat& r)
}
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;
... ... @@ -421,6 +436,7 @@ bool srs_get_disk_diskstats_stat(SrsDiskStat& r)
return true;
}
#ifndef SRS_OSX
FILE* f = fopen("/proc/diskstats", "r");
if (f == NULL) {
srs_warn("open vmstat failed, ignore");
... ... @@ -485,6 +501,10 @@ bool srs_get_disk_diskstats_stat(SrsDiskStat& r)
}
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;
... ... @@ -575,14 +595,15 @@ SrsMemInfo* srs_get_meminfo()
void srs_update_meminfo()
{
SrsMemInfo& r = _srs_system_meminfo;
#ifndef SRS_OSX
FILE* f = fopen("/proc/meminfo", "r");
if (f == NULL) {
srs_warn("open meminfo failed, ignore");
return;
}
SrsMemInfo& r = _srs_system_meminfo;
static char buf[1024];
while (fgets(buf, sizeof(buf), f)) {
// @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);
#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.MemActive = r.MemTotal - r.MemFree;
... ... @@ -781,6 +806,7 @@ int srs_get_network_devices_count()
void srs_update_network_devices()
{
#ifndef SRS_OSX
if (true) {
FILE* f = fopen("/proc/net/dev", "r");
if (f == NULL) {
... ... @@ -815,6 +841,10 @@ void srs_update_network_devices()
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()
... ... @@ -862,6 +892,7 @@ void srs_update_rtmp_server(int nb_conn, SrsKbps* kbps)
int nb_tcp_mem = 0;
int nb_udp4 = 0;
#ifndef SRS_OSX
if (true) {
FILE* f = fopen("/proc/net/sockstat", "r");
if (f == NULL) {
... ... @@ -891,9 +922,21 @@ void srs_update_rtmp_server(int nb_conn, SrsKbps* kbps)
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;
#ifndef SRS_OSX
if (true) {
FILE* f = fopen("/proc/net/snmp", "r");
if (f == NULL) {
... ... @@ -923,6 +966,10 @@ void srs_update_rtmp_server(int nb_conn, SrsKbps* kbps)
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
// 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
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_REVISION 145
#define VERSION_REVISION 146
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
... ...