Emx::Misc类 参考

未分类的各种操作接口

#include "Misc.hpp"

struct  SysUsage
 系统资源使用情况 更多...
 

静态 Public 成员函数

static void BindCpu (int num)
 绑定当前线程到指定CPU核心 更多...
 
static uint32_t GetRSS ()
 获取当前进程物理内存使用情况 更多...
 
static void GetResUsage (uv_rusage_t &usage)
 获取进程资源使用情况 更多...
 
static ErrCodeE GetSysUsage (SysUsage &usage, int calcTimeMs)
 获取系统资源使用情况 更多...
 
static bool ApplicationExist (const char *app)
 根据名字检查对应的进程是否存在 更多...
 
static void KillBeforeRun ()
 kill掉与本进程同名的进程 更多...
 
static void KillBeforeRun (const char *cmd)
 kill掉与本进程同名的进程 更多...
 
static void UIntToArray (uint32_t num, uint8_t *array)
 整型转字节数组 更多...
 
static uint32_t ArrayToUint32 (uint8_t *array)
 字节数组转整型 更多...
 
static int GetRandom (int min=0, int max=INT_MAX)
 根据范围获取随机数 更多...
 
static void MakeAddr4 (const char *ip, int port, struct sockaddr_in *addr)
 根据ip和port生成ipv4 sock 地址 更多...
 
static void MakeAddr6 (const char *ip, int port, struct sockaddr_in6 *addr)
 根据ip和port生成ipv6 sock 地址 更多...
 

静态 Public 属性

static const char * RebootTopic
 

成员函数说明

◆ BindCpu()

static void Emx::Misc::BindCpu ( int  num)
static
参数
num[in] CPU核心

◆ GetRSS()

static uint32_t Emx::Misc::GetRSS ( )
static
返回
物理内存,单位字节

◆ GetResUsage()

static void Emx::Misc::GetResUsage ( uv_rusage_t &  usage)
static
参数
usage[out] 资源使用情况

◆ GetSysUsage()

static ErrCodeE Emx::Misc::GetSysUsage ( SysUsage usage,
int  calcTimeMs 
)
static
参数
usage[out] 资源使用情况
calcTimeMs[in] 统计计算时间ms

◆ ApplicationExist()

static bool Emx::Misc::ApplicationExist ( const char *  app)
static
参数
app[in]进程明
返回
是否存在

◆ KillBeforeRun() [1/2]

static void Emx::Misc::KillBeforeRun ( )
static

◆ KillBeforeRun() [2/2]

static void Emx::Misc::KillBeforeRun ( const char *  cmd)
static
参数
cmd进程名

◆ UIntToArray()

static void Emx::Misc::UIntToArray ( uint32_t  num,
uint8_t *  array 
)
static
参数
num[in] 输入整型数
array[out] 输出字节数组

◆ ArrayToUint32()

static uint32_t Emx::Misc::ArrayToUint32 ( uint8_t *  array)
static
参数
array[in]输入字节数组
返回
返回整型

◆ GetRandom()

static int Emx::Misc::GetRandom ( int  min = 0,
int  max = INT_MAX 
)
static
参数
min[in]最小值
max[in]最大值
返回
随机数

◆ MakeAddr4()

static void Emx::Misc::MakeAddr4 ( const char *  ip,
int  port,
struct sockaddr_in *  addr 
)
inlinestatic
参数
ip[in]ipv4地址
port[in]端口
addr[out]sock地址

◆ MakeAddr6()

static void Emx::Misc::MakeAddr6 ( const char *  ip,
int  port,
struct sockaddr_in6 *  addr 
)
inlinestatic
参数
ip[in]ipv6地址
port[in]端口
addr[out]sock地址

类成员变量说明

◆ RebootTopic

const char* Emx::Misc::RebootTopic
static