mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
新增getWorkThreadsLoad接口
This commit is contained in:
parent
a739bd7304
commit
1f89a86892
@ -45,6 +45,7 @@
|
||||
#include "Util/MD5.h"
|
||||
#include "WebApi.h"
|
||||
#include "WebHook.h"
|
||||
#include "Thread/WorkThreadPool.h"
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#include "FFmpegSource.h"
|
||||
@ -281,6 +282,23 @@ void installWebApi() {
|
||||
});
|
||||
});
|
||||
|
||||
//获取后台工作线程负载
|
||||
//测试url http://127.0.0.1/index/api/getWorkThreadsLoad
|
||||
API_REGIST_INVOKER(api, getWorkThreadsLoad, {
|
||||
WorkThreadPool::Instance().getExecutorDelay([invoker, headerOut](const vector<int> &vecDelay) {
|
||||
Value val;
|
||||
auto vec = WorkThreadPool::Instance().getExecutorLoad();
|
||||
int i = 0;
|
||||
for (auto load : vec) {
|
||||
Value obj(objectValue);
|
||||
obj["load"] = load;
|
||||
obj["delay"] = vecDelay[i++];
|
||||
val["data"].append(obj);
|
||||
}
|
||||
invoker("200 OK", headerOut, val.toStyledString());
|
||||
});
|
||||
});
|
||||
|
||||
//获取服务器配置
|
||||
//测试url http://127.0.0.1/index/api/getServerConfig
|
||||
API_REGIST(api, getServerConfig, {
|
||||
|
Loading…
Reference in New Issue
Block a user