正在显示
4 个修改的文件
包含
31 行增加
和
8 行删除
| @@ -209,6 +209,7 @@ Supported operating systems and hardware: | @@ -209,6 +209,7 @@ Supported operating systems and hardware: | ||
| 209 | * 2013-10-17, Created.<br/> | 209 | * 2013-10-17, Created.<br/> |
| 210 | 210 | ||
| 211 | ## History | 211 | ## History |
| 212 | +* v1.0, 2014-07-27, api connections add udp, add disk iops. 0.9.176 | ||
| 212 | * v1.0, 2014-07-26, complete config utest. 0.9.173 | 213 | * v1.0, 2014-07-26, complete config utest. 0.9.173 |
| 213 | * v1.0, 2014-07-26, fix [#124](https://github.com/winlinvip/simple-rtmp-server/issues/124), gop cache support disable video in publishing. 0.9.171. | 214 | * v1.0, 2014-07-26, fix [#124](https://github.com/winlinvip/simple-rtmp-server/issues/124), gop cache support disable video in publishing. 0.9.171. |
| 214 | * v1.0, 2014-07-23, fix [#121](https://github.com/winlinvip/simple-rtmp-server/issues/121), srs_info detail log compile failed. 0.9.168. | 215 | * v1.0, 2014-07-23, fix [#121](https://github.com/winlinvip/simple-rtmp-server/issues/121), srs_info detail log compile failed. 0.9.168. |
| @@ -245,11 +245,6 @@ bool get_proc_system_stat(SrsProcSystemStat& r) | @@ -245,11 +245,6 @@ bool get_proc_system_stat(SrsProcSystemStat& r) | ||
| 245 | // matched ok. | 245 | // matched ok. |
| 246 | r.ok = true; | 246 | r.ok = true; |
| 247 | 247 | ||
| 248 | - // @see: http://tester-higkoo.googlecode.com/svn-history/r14/trunk/Tools/iostat/iostat.c | ||
| 249 | - // add the interrupts to sys. | ||
| 250 | - // TODO: FIXME: check out it. | ||
| 251 | - r.sys += r.irq + r.softirq; | ||
| 252 | - | ||
| 253 | break; | 248 | break; |
| 254 | } | 249 | } |
| 255 | 250 | ||
| @@ -362,6 +357,7 @@ SrsDiskStat::SrsDiskStat() | @@ -362,6 +357,7 @@ SrsDiskStat::SrsDiskStat() | ||
| 362 | ok = false; | 357 | ok = false; |
| 363 | sample_time = 0; | 358 | sample_time = 0; |
| 364 | in_KBps = out_KBps = 0; | 359 | in_KBps = out_KBps = 0; |
| 360 | + busy = 0; | ||
| 365 | 361 | ||
| 366 | pgpgin = 0; | 362 | pgpgin = 0; |
| 367 | pgpgout = 0; | 363 | pgpgout = 0; |
| @@ -515,6 +511,26 @@ void srs_update_disk_stat() | @@ -515,6 +511,26 @@ void srs_update_disk_stat() | ||
| 515 | r.out_KBps = (r.pgpgout - o.pgpgout) * 1000 / duration_ms; | 511 | r.out_KBps = (r.pgpgout - o.pgpgout) * 1000 / duration_ms; |
| 516 | } | 512 | } |
| 517 | } | 513 | } |
| 514 | + | ||
| 515 | + // diskstats | ||
| 516 | + if (true) { | ||
| 517 | + SrsProcSystemStat* cpu = srs_get_system_proc_stat(); | ||
| 518 | + SrsCpuInfo* cpuinfo = srs_get_cpuinfo(); | ||
| 519 | + | ||
| 520 | + if (cpu->ok && cpu->total_delta > 0 | ||
| 521 | + && cpuinfo->ok && cpuinfo->nb_processors > 0 | ||
| 522 | + && o.ticks < r.ticks | ||
| 523 | + ) { | ||
| 524 | + // @see: print_partition_stats() of iostat.c | ||
| 525 | + double delta_ms = cpu->total_delta * 10 / cpuinfo->nb_processors; | ||
| 526 | + unsigned int ticks = r.ticks - o.ticks; | ||
| 527 | + | ||
| 528 | + // busy in [0, 1], where 0.1532 means 15.32% | ||
| 529 | + r.busy = srs_min(1, (float)(ticks / delta_ms)); | ||
| 530 | + } | ||
| 531 | + } | ||
| 532 | + | ||
| 533 | + _srs_disk_stat = r; | ||
| 518 | } | 534 | } |
| 519 | 535 | ||
| 520 | SrsMemInfo::SrsMemInfo() | 536 | SrsMemInfo::SrsMemInfo() |
| @@ -1065,8 +1081,9 @@ void srs_api_dump_summaries(std::stringstream& ss) | @@ -1065,8 +1081,9 @@ void srs_api_dump_summaries(std::stringstream& ss) | ||
| 1065 | << __SRS_JOBJECT_END << __SRS_JFIELD_CONT | 1081 | << __SRS_JOBJECT_END << __SRS_JFIELD_CONT |
| 1066 | << __SRS_JFIELD_ORG("system", __SRS_JOBJECT_START) | 1082 | << __SRS_JFIELD_ORG("system", __SRS_JOBJECT_START) |
| 1067 | << __SRS_JFIELD_ORG("cpu_percent", s->percent) << __SRS_JFIELD_CONT | 1083 | << __SRS_JFIELD_ORG("cpu_percent", s->percent) << __SRS_JFIELD_CONT |
| 1068 | - << __SRS_JFIELD_ORG("disk_in_KBps", d->in_KBps) << __SRS_JFIELD_CONT | ||
| 1069 | - << __SRS_JFIELD_ORG("disk_out_KBps", d->out_KBps) << __SRS_JFIELD_CONT | 1084 | + << __SRS_JFIELD_ORG("disk_read_KBps", d->in_KBps) << __SRS_JFIELD_CONT |
| 1085 | + << __SRS_JFIELD_ORG("disk_write_KBps", d->out_KBps) << __SRS_JFIELD_CONT | ||
| 1086 | + << __SRS_JFIELD_ORG("disk_busy_percent", d->busy) << __SRS_JFIELD_CONT | ||
| 1070 | << __SRS_JFIELD_ORG("mem_ram_kbyte", m->MemTotal) << __SRS_JFIELD_CONT | 1087 | << __SRS_JFIELD_ORG("mem_ram_kbyte", m->MemTotal) << __SRS_JFIELD_CONT |
| 1071 | << __SRS_JFIELD_ORG("mem_ram_percent", m->percent_ram) << __SRS_JFIELD_CONT | 1088 | << __SRS_JFIELD_ORG("mem_ram_percent", m->percent_ram) << __SRS_JFIELD_CONT |
| 1072 | << __SRS_JFIELD_ORG("mem_swap_kbyte", m->SwapTotal) << __SRS_JFIELD_CONT | 1089 | << __SRS_JFIELD_ORG("mem_swap_kbyte", m->SwapTotal) << __SRS_JFIELD_CONT |
| @@ -332,11 +332,16 @@ public: | @@ -332,11 +332,16 @@ public: | ||
| 332 | bool ok; | 332 | bool ok; |
| 333 | // the time in ms when sample. | 333 | // the time in ms when sample. |
| 334 | int64_t sample_time; | 334 | int64_t sample_time; |
| 335 | + | ||
| 335 | // input(read) KBytes per seconds | 336 | // input(read) KBytes per seconds |
| 336 | int in_KBps; | 337 | int in_KBps; |
| 337 | // output(write) KBytes per seconds | 338 | // output(write) KBytes per seconds |
| 338 | int out_KBps; | 339 | int out_KBps; |
| 339 | 340 | ||
| 341 | + // @see: print_partition_stats() of iostat.c | ||
| 342 | + // but its value is [0, 1], for instance, 0.1532 means 15.32%. | ||
| 343 | + float busy; | ||
| 344 | + | ||
| 340 | public: | 345 | public: |
| 341 | // @see: cat /proc/vmstat | 346 | // @see: cat /proc/vmstat |
| 342 | // the in(read) page count, pgpgin*1024 is the read bytes. | 347 | // the in(read) page count, pgpgin*1024 is the read bytes. |
| @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 31 | // current release version | 31 | // current release version |
| 32 | #define VERSION_MAJOR "0" | 32 | #define VERSION_MAJOR "0" |
| 33 | #define VERSION_MINOR "9" | 33 | #define VERSION_MINOR "9" |
| 34 | -#define VERSION_REVISION "175" | 34 | +#define VERSION_REVISION "176" |
| 35 | #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION | 35 | #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION |
| 36 | // server info. | 36 | // server info. |
| 37 | #define RTMP_SIG_SRS_KEY "SRS" | 37 | #define RTMP_SIG_SRS_KEY "SRS" |
-
请 注册 或 登录 后发表评论