add connection stats

pull/48/head
yuqing 2014-09-13 22:38:45 +08:00
parent 2a900c23aa
commit b32ef5c3ca
5 changed files with 23 additions and 6 deletions

View File

@ -381,6 +381,13 @@ int tracker_list_servers(ConnectionInfo *pTrackerServer, \
pDest->current_write_path = buff2long( \
pSrc->sz_current_write_path);
pStorageStat->connection.alloc_count = buff2int( \
pStatBuff->connection.sz_alloc_count);
pStorageStat->connection.current_count = buff2int( \
pStatBuff->connection.sz_current_count);
pStorageStat->connection.max_count = buff2int( \
pStatBuff->connection.sz_max_count);
pStorageStat->total_upload_count = buff2long( \
pStatBuff->sz_total_upload_count);
pStorageStat->success_upload_count = buff2long( \

View File

@ -68,7 +68,9 @@ 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);
++g_stat_change_count;
}
static int set_recv_event(struct fast_task_info *pTask)

View File

@ -1857,6 +1857,7 @@ static void *accept_thread_entrance(void* arg)
if (current_connections > g_connection_stat.max_count) {
g_connection_stat.max_count = current_connections;
}
++g_stat_change_count;
}
}

View File

@ -2133,11 +2133,11 @@ static int tracker_heart_beat(ConnectionInfo *pTrackerServer, \
pStatBuff = (FDFSStorageStatBuff *)( \
out_buff + sizeof(TrackerHeader));
long2buff(free_queue_alloc_connections(), \
int2buff(free_queue_alloc_connections(), \
pStatBuff->connection.sz_alloc_count);
long2buff(g_storage_stat.connection.current_count, \
int2buff(g_storage_stat.connection.current_count, \
pStatBuff->connection.sz_current_count);
long2buff(g_storage_stat.connection.max_count, \
int2buff(g_storage_stat.connection.max_count, \
pStatBuff->connection.sz_max_count);
long2buff(g_storage_stat.total_upload_count, \

View File

@ -2223,6 +2223,13 @@ 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, \
pStatBuff->connection.sz_current_count);
int2buff(pStorageStat->connection.max_count, \
pStatBuff->connection.sz_max_count);
long2buff(pStorageStat->total_upload_count, \
pStatBuff->sz_total_upload_count);
long2buff(pStorageStat->success_upload_count, \
@ -3521,11 +3528,11 @@ static int tracker_deal_storage_beat(struct fast_task_info *pTask)
pStat = &(pClientInfo->pStorage->stat);
pStat->connection.alloc_count = \
buff2long(pStatBuff->connection.sz_alloc_count);
buff2int(pStatBuff->connection.sz_alloc_count);
pStat->connection.current_count = \
buff2long(pStatBuff->connection.sz_current_count);
buff2int(pStatBuff->connection.sz_current_count);
pStat->connection.max_count = \
buff2long(pStatBuff->connection.sz_max_count);
buff2int(pStatBuff->connection.sz_max_count);
pStat->total_upload_count = \
buff2long(pStatBuff->sz_total_upload_count);