initial commit

This commit is contained in:
2025-08-05 15:53:44 +08:00
commit 09dc02ae52
553 changed files with 137665 additions and 0 deletions

29
common/utils/ratelimit.c Executable file
View File

@@ -0,0 +1,29 @@
/**********************************************************************************************
File name : ratelimit.h
Module : common
Author :
Copyright :
Version : 0.1
Created on : 2021-11-18
Creator : amir.liang
Description :
以一定的速率执行入参函数, ratelimit(func()); 每次call这个调用默认每5秒最多执行一次func()
Modify History:
1. Date: Author: Modification:
************************************************************************************************/
#include "ratelimit.h"
static void retalimit_delay(){
hv_msleep(500);
}
void retalimit_test()
{
uint64_t start = gettimeofday_ms();
LOG_TIME(retalimit_delay());
while(gettimeofday_ms() - start < 1000){
ratelimit(printf("%s test\n", __func__));
}
LOG_TIME("retalimit_delay()");
}