mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-23 19:43:09 +00:00
convert spaces into tab
keep convention
This commit is contained in:
@@ -73,7 +73,7 @@ connection_deletepool(struct connection_pool * pool) {
|
||||
#if HAVE_EPOLL
|
||||
close(pool->epoll_fd);
|
||||
#elif HAVE_KQUEUE
|
||||
close(pool->kqueue_fd);
|
||||
close(pool->kqueue_fd);
|
||||
#endif
|
||||
free(pool);
|
||||
}
|
||||
|
||||
@@ -35,11 +35,11 @@ _stat_begin(struct stat *S, struct timespec *ti) {
|
||||
#if defined(_POSIX_TIMERS) && defined(_POSIX_THREAD_CPUTIME)
|
||||
clock_gettime(CLOCK_THREAD_CPUTIME_ID, ti);
|
||||
#elif defined(__APPLE__)
|
||||
struct task_thread_times_info aTaskInfo;
|
||||
mach_msg_type_number_t aTaskInfoCount = TASK_THREAD_TIMES_INFO_COUNT;
|
||||
assert(KERN_SUCCESS == task_info(mach_task_self(), TASK_THREAD_TIMES_INFO, (task_info_t )&aTaskInfo, &aTaskInfoCount));
|
||||
ti->tv_sec = aTaskInfo.user_time.seconds;
|
||||
ti->tv_nsec = aTaskInfo.user_time.microseconds * 1000;
|
||||
struct task_thread_times_info aTaskInfo;
|
||||
mach_msg_type_number_t aTaskInfoCount = TASK_THREAD_TIMES_INFO_COUNT;
|
||||
assert(KERN_SUCCESS == task_info(mach_task_self(), TASK_THREAD_TIMES_INFO, (task_info_t )&aTaskInfo, &aTaskInfoCount));
|
||||
ti->tv_sec = aTaskInfo.user_time.seconds;
|
||||
ti->tv_nsec = aTaskInfo.user_time.microseconds * 1000;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -19,11 +19,11 @@ diff_time(struct timespec *ti, uint32_t *sec, uint32_t *nsec) {
|
||||
#if defined(_POSIX_TIMERS) && defined(_POSIX_THREAD_CPUTIME)
|
||||
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &end);
|
||||
#elif defined(__APPLE__)
|
||||
struct task_thread_times_info aTaskInfo;
|
||||
mach_msg_type_number_t aTaskInfoCount = TASK_THREAD_TIMES_INFO_COUNT;
|
||||
assert(KERN_SUCCESS == task_info(mach_task_self(), TASK_THREAD_TIMES_INFO, (task_info_t )&aTaskInfo, &aTaskInfoCount));
|
||||
end.tv_sec = aTaskInfo.user_time.seconds;
|
||||
end.tv_nsec = aTaskInfo.user_time.microseconds * 1000;
|
||||
struct task_thread_times_info aTaskInfo;
|
||||
mach_msg_type_number_t aTaskInfoCount = TASK_THREAD_TIMES_INFO_COUNT;
|
||||
assert(KERN_SUCCESS == task_info(mach_task_self(), TASK_THREAD_TIMES_INFO, (task_info_t )&aTaskInfo, &aTaskInfoCount));
|
||||
end.tv_sec = aTaskInfo.user_time.seconds;
|
||||
end.tv_nsec = aTaskInfo.user_time.microseconds * 1000;
|
||||
#endif
|
||||
int diffsec = end.tv_sec - ti->tv_sec;
|
||||
assert(diffsec>=0);
|
||||
@@ -92,11 +92,11 @@ trace_new(struct trace_pool *p) {
|
||||
#if defined(_POSIX_TIMERS) && defined(_POSIX_THREAD_CPUTIME)
|
||||
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &t->ti);
|
||||
#elif defined(__APPLE__)
|
||||
struct task_thread_times_info aTaskInfo;
|
||||
mach_msg_type_number_t aTaskInfoCount = TASK_THREAD_TIMES_INFO_COUNT;
|
||||
assert(KERN_SUCCESS == task_info(mach_task_self(), TASK_THREAD_TIMES_INFO, (task_info_t )&aTaskInfo, &aTaskInfoCount));
|
||||
t->ti.tv_sec = aTaskInfo.user_time.seconds;
|
||||
t->ti.tv_nsec = aTaskInfo.user_time.microseconds * 1000;
|
||||
struct task_thread_times_info aTaskInfo;
|
||||
mach_msg_type_number_t aTaskInfoCount = TASK_THREAD_TIMES_INFO_COUNT;
|
||||
assert(KERN_SUCCESS == task_info(mach_task_self(), TASK_THREAD_TIMES_INFO, (task_info_t )&aTaskInfo, &aTaskInfoCount));
|
||||
t->ti.tv_sec = aTaskInfo.user_time.seconds;
|
||||
t->ti.tv_nsec = aTaskInfo.user_time.microseconds * 1000;
|
||||
#endif
|
||||
return t;
|
||||
}
|
||||
@@ -152,13 +152,13 @@ trace_switch(struct trace_pool *p, int session) {
|
||||
t->next->prev = prev;
|
||||
}
|
||||
#if defined(_POSIX_TIMERS) && defined(_POSIX_THREAD_CPUTIME)
|
||||
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &t->ti);
|
||||
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &t->ti);
|
||||
#elif defined(__APPLE__)
|
||||
struct task_thread_times_info aTaskInfo;
|
||||
mach_msg_type_number_t aTaskInfoCount = TASK_THREAD_TIMES_INFO_COUNT;
|
||||
assert(KERN_SUCCESS == task_info(mach_task_self(), TASK_THREAD_TIMES_INFO, (task_info_t )&aTaskInfo, &aTaskInfoCount));
|
||||
t->ti.tv_sec = aTaskInfo.user_time.seconds;
|
||||
t->ti.tv_nsec = aTaskInfo.user_time.microseconds * 1000;
|
||||
struct task_thread_times_info aTaskInfo;
|
||||
mach_msg_type_number_t aTaskInfoCount = TASK_THREAD_TIMES_INFO_COUNT;
|
||||
assert(KERN_SUCCESS == task_info(mach_task_self(), TASK_THREAD_TIMES_INFO, (task_info_t )&aTaskInfo, &aTaskInfoCount));
|
||||
t->ti.tv_sec = aTaskInfo.user_time.seconds;
|
||||
t->ti.tv_nsec = aTaskInfo.user_time.microseconds * 1000;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -202,17 +202,17 @@ skynet_timeout(uint32_t handle, int time, int session) {
|
||||
|
||||
static uint32_t
|
||||
_gettime(void) {
|
||||
uint32_t t;
|
||||
uint32_t t;
|
||||
#if defined(_POSIX_TIMERS)
|
||||
struct timespec ti;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ti);
|
||||
t = (uint32_t)(ti.tv_sec & 0xffffff) * 100;
|
||||
t = (uint32_t)(ti.tv_sec & 0xffffff) * 100;
|
||||
t += ti.tv_nsec / 10000000;
|
||||
#else
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
t = (uint32_t)(tv.tv_sec & 0xffffff) * 100;
|
||||
t += tv.tv_usec / 10000;
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
t = (uint32_t)(tv.tv_sec & 0xffffff) * 100;
|
||||
t += tv.tv_usec / 10000;
|
||||
#endif
|
||||
return t;
|
||||
}
|
||||
@@ -250,9 +250,9 @@ skynet_timer_init(void) {
|
||||
clock_gettime(CLOCK_REALTIME, &ti);
|
||||
uint32_t sec = (uint32_t)ti.tv_sec;
|
||||
#else
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
uint32_t sec = (uint32_t)tv.tv_sec;
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
uint32_t sec = (uint32_t)tv.tv_sec;
|
||||
#endif
|
||||
uint32_t mono = _gettime() / 100;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user