TSG-10720,TSG-10722: SAPP提供获取链接最后一个数据包到达时间毫秒级的接口,精确计算链接通信时长(Duration)
This commit is contained in:
@@ -175,7 +175,6 @@ int tsg_get_umts_user_info(const struct streaminfo *a_stream, struct umts_user_i
|
|||||||
|
|
||||||
int tsg_gtp_signaling_hash_init(const char* conffile, void *logger)
|
int tsg_gtp_signaling_hash_init(const char* conffile, void *logger)
|
||||||
{
|
{
|
||||||
int hash_switch=0;
|
|
||||||
MESA_load_profile_int_def(conffile, "GTP_SIGNALING", "HASH_SWITCH", &g_tsg_para.hash_switch, 1);
|
MESA_load_profile_int_def(conffile, "GTP_SIGNALING", "HASH_SWITCH", &g_tsg_para.hash_switch, 1);
|
||||||
if(g_tsg_para.hash_switch==0)
|
if(g_tsg_para.hash_switch==0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -490,9 +490,8 @@ static int set_tuple4(struct tsg_log_instance_t *_instance, struct TLD_handle_t
|
|||||||
static int set_duraction(struct tsg_log_instance_t *_instance, struct TLD_handle_t *_handle, struct streaminfo *a_stream)
|
static int set_duraction(struct tsg_log_instance_t *_instance, struct TLD_handle_t *_handle, struct streaminfo *a_stream)
|
||||||
{
|
{
|
||||||
int ret=0;
|
int ret=0;
|
||||||
struct timespec tv;
|
|
||||||
long common_con_duration_ms=0;
|
long common_con_duration_ms=0;
|
||||||
unsigned long long create_time=0;
|
unsigned long long create_time=0,last_time=0;
|
||||||
int size=sizeof(unsigned long long);
|
int size=sizeof(unsigned long long);
|
||||||
|
|
||||||
if(a_stream->ptcpdetail!=NULL)
|
if(a_stream->ptcpdetail!=NULL)
|
||||||
@@ -503,15 +502,14 @@ static int set_duraction(struct tsg_log_instance_t *_instance, struct TLD_handle
|
|||||||
ret=MESA_get_stream_opt(a_stream, MSO_STREAM_CREATE_TIMESTAMP_MS, (void *)&create_time, &size);
|
ret=MESA_get_stream_opt(a_stream, MSO_STREAM_CREATE_TIMESTAMP_MS, (void *)&create_time, &size);
|
||||||
if(ret>=0)
|
if(ret>=0)
|
||||||
{
|
{
|
||||||
clock_gettime(CLOCK_REALTIME, &tv);
|
ret=MESA_get_stream_opt(a_stream, MSO_STREAM_LASTUPDATE_TIMESTAMP_MS, (void *)&last_time, &size);
|
||||||
common_con_duration_ms=tv.tv_sec*1000+tv.tv_nsec/1000/1000 - create_time;
|
if(ret>=0 && last_time>create_time)
|
||||||
}
|
|
||||||
|
|
||||||
if(common_con_duration_ms>0)
|
|
||||||
{
|
{
|
||||||
|
common_con_duration_ms=last_time-create_time;
|
||||||
TLD_append(_handle, _instance->id2field[LOG_COMMON_CON_DURATION_MS].name, (void *)(common_con_duration_ms), TLD_TYPE_LONG);
|
TLD_append(_handle, _instance->id2field[LOG_COMMON_CON_DURATION_MS].name, (void *)(common_con_duration_ms), TLD_TYPE_LONG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
time_t cur_time=time(NULL);
|
time_t cur_time=time(NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user