Skip to content

Commit

Permalink
convert spaces into tab
Browse files Browse the repository at this point in the history
keep convention
  • Loading branch information
cofyc committed Nov 27, 2012
1 parent 8f29655 commit 655a2b6
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion connection/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
10 changes: 5 additions & 5 deletions lualib-src/lua-skynet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
32 changes: 16 additions & 16 deletions lualib-src/trace_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
18 changes: 9 additions & 9 deletions skynet-src/skynet_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 655a2b6

Please sign in to comment.