add connection stats
parent
b32ef5c3ca
commit
738a3208b9
|
|
@ -331,6 +331,9 @@ static int fdfs_dump_storage_stat(char *buff, const int buffSize)
|
|||
total_len = snprintf(buff, buffSize,
|
||||
"\ng_stat_change_count=%d\n"
|
||||
"g_sync_change_count=%d\n"
|
||||
"alloc_count=%d\n"
|
||||
"current_count=%d\n"
|
||||
"max_count=%d\n"
|
||||
"total_upload_count=%"PRId64"\n"
|
||||
"success_upload_count=%"PRId64"\n"
|
||||
"total_set_meta_count=%"PRId64"\n"
|
||||
|
|
@ -350,6 +353,9 @@ static int fdfs_dump_storage_stat(char *buff, const int buffSize)
|
|||
"last_synced_timestamp=%s\n"
|
||||
"last_heart_beat_time=%s\n",
|
||||
g_stat_change_count, g_sync_change_count,
|
||||
free_queue_alloc_connections(),
|
||||
g_storage_stat.connection.current_count,
|
||||
g_storage_stat.connection.max_count,
|
||||
g_storage_stat.total_upload_count,
|
||||
g_storage_stat.success_upload_count,
|
||||
g_storage_stat.total_set_meta_count,
|
||||
|
|
|
|||
|
|
@ -124,8 +124,6 @@ char g_exe_name[256] = {0};
|
|||
struct storage_nio_thread_data *g_nio_thread_data = NULL;
|
||||
struct storage_dio_thread_data *g_dio_thread_data = NULL;
|
||||
|
||||
FDFSConnectionStat g_connection_stat = {0, 0};
|
||||
|
||||
int storage_cmp_by_server_id(const void *p1, const void *p2)
|
||||
{
|
||||
return strcmp((*((FDFSStorageServer **)p1))->server.id,
|
||||
|
|
|
|||
|
|
@ -171,8 +171,6 @@ extern char g_exe_name[256];
|
|||
extern struct storage_nio_thread_data *g_nio_thread_data; //network io thread data
|
||||
extern struct storage_dio_thread_data *g_dio_thread_data; //disk io thread data
|
||||
|
||||
extern FDFSConnectionStat g_connection_stat;
|
||||
|
||||
int storage_cmp_by_server_id(const void *p1, const void *p2);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ void task_finish_clean_up(struct fast_task_info *pTask)
|
|||
memset(pTask->arg, 0, sizeof(StorageClientInfo));
|
||||
free_queue_push(pTask);
|
||||
|
||||
__sync_fetch_and_sub(&g_connection_stat.current_count, 1);
|
||||
__sync_fetch_and_sub(&g_storage_stat.connection.current_count, 1);
|
||||
++g_stat_change_count;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1852,10 +1852,10 @@ static void *accept_thread_entrance(void* arg)
|
|||
else
|
||||
{
|
||||
int current_connections;
|
||||
current_connections = __sync_add_and_fetch(&g_connection_stat.
|
||||
current_connections = __sync_add_and_fetch(&g_storage_stat.connection.
|
||||
current_count, 1);
|
||||
if (current_connections > g_connection_stat.max_count) {
|
||||
g_connection_stat.max_count = current_connections;
|
||||
if (current_connections > g_storage_stat.connection.max_count) {
|
||||
g_storage_stat.connection.max_count = current_connections;
|
||||
}
|
||||
++g_stat_change_count;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2223,6 +2223,7 @@ static int tracker_deal_server_list_group_storages(struct fast_task_info *pTask)
|
|||
long2buff((*ppServer)->current_write_path, \
|
||||
pDest->sz_current_write_path);
|
||||
|
||||
|
||||
int2buff(pStorageStat->connection.alloc_count, \
|
||||
pStatBuff->connection.sz_alloc_count);
|
||||
int2buff(pStorageStat->connection.current_count, \
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ typedef struct
|
|||
|
||||
struct {
|
||||
int alloc_count;
|
||||
int current_count;
|
||||
volatile int current_count;
|
||||
int max_count;
|
||||
} connection;
|
||||
} FDFSStorageStat;
|
||||
|
|
@ -454,7 +454,7 @@ typedef struct {
|
|||
|
||||
typedef struct fdfs_connection_stat {
|
||||
volatile int current_count;
|
||||
volatile int max_count;
|
||||
int max_count;
|
||||
} FDFSConnectionStat;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue