Lines Matching refs:thr

35 static void nxt_thread_realtime_update(nxt_thread_t *thr,
37 static u_char *nxt_thread_time_string_no_cache(nxt_thread_t *thr,
40 static nxt_time_string_cache_t *nxt_thread_time_string_cache(nxt_thread_t *thr,
50 nxt_thread_time_update(nxt_thread_t *thr) in nxt_thread_time_update() argument
53 nxt_thread_time_shared(&thr->time.now); in nxt_thread_time_update()
56 nxt_monotonic_time(&thr->time.now); in nxt_thread_time_update()
62 nxt_thread_time_free(nxt_thread_t *thr) in nxt_thread_time_free() argument
67 tsc = thr->time.strings; in nxt_thread_time_free()
70 thr->time.no_cache = 1; in nxt_thread_time_free()
72 for (i = 0; i < thr->time.nstrings; i++) { in nxt_thread_time_free()
77 thr->time.strings = NULL; in nxt_thread_time_free()
103 nxt_thread_t *thr; in nxt_time_thread() local
109 thr = nxt_thread(); in nxt_time_thread()
114 thr->time.signal = -1; in nxt_time_thread()
116 nxt_log_debug(thr->log, "time thread"); in nxt_time_thread()
121 nxt_thread_realtime_update(thr, &now); in nxt_time_thread()
132 nxt_thread_realtime_update(thr, &now); in nxt_time_thread()
137 thr->time.now = now; in nxt_time_thread()
138 nxt_log_debug(thr->log, "time thread"); in nxt_time_thread()
178 nxt_thread_time(nxt_thread_t *thr) in nxt_thread_time() argument
180 nxt_thread_realtime_update(thr, &thr->time.now); in nxt_thread_time()
182 return thr->time.now.realtime.sec; in nxt_thread_time()
187 nxt_thread_realtime(nxt_thread_t *thr) in nxt_thread_realtime() argument
189 nxt_thread_realtime_update(thr, &thr->time.now); in nxt_thread_realtime()
191 return &thr->time.now.realtime; in nxt_thread_realtime()
196 nxt_thread_realtime_update(nxt_thread_t *thr, nxt_monotonic_time_t *now) in nxt_thread_realtime_update() argument
202 if (nxt_slow_path(thr->log->level == NXT_LOG_DEBUG || nxt_debug)) { in nxt_thread_realtime_update()
226 nxt_thread_time_string(nxt_thread_t *thr, nxt_time_string_t *ts, u_char *buf) in nxt_thread_time_string() argument
235 if (nxt_slow_path(thr == NULL || thr->time.no_cache)) { in nxt_thread_time_string()
236 return nxt_thread_time_string_no_cache(thr, ts, buf); in nxt_thread_time_string()
241 tsc = nxt_thread_time_string_cache(thr, slot); in nxt_thread_time_string()
246 if (thr->time.signal < 0) { in nxt_thread_time_string()
251 nxt_thread_realtime_update(thr, &thr->time.now); in nxt_thread_time_string()
254 s = thr->time.now.realtime.sec; in nxt_thread_time_string()
261 && (nxt_slow_path(thr->log->level == NXT_LOG_DEBUG || nxt_debug))) in nxt_thread_time_string()
265 ms = thr->time.now.realtime.nsec / 1000000; in nxt_thread_time_string()
276 tm = &thr->time.localtime; in nxt_thread_time_string()
278 if (nxt_slow_path(s != thr->time.last_localtime)) { in nxt_thread_time_string()
280 if (thr->time.signal < 0) { in nxt_thread_time_string()
285 nxt_localtime(s, &thr->time.localtime); in nxt_thread_time_string()
286 thr->time.last_localtime = s; in nxt_thread_time_string()
311 tm = &thr->time.gmtime; in nxt_thread_time_string()
313 if (nxt_slow_path(s != thr->time.last_gmtime)) { in nxt_thread_time_string()
315 thr->time.last_gmtime = s; in nxt_thread_time_string()
324 thr->time.no_cache = 1; in nxt_thread_time_string()
326 thr->time.no_cache = 0; in nxt_thread_time_string()
335 p = ts->handler(p, &thr->time.now.realtime, tm, ts->size, ts->format); in nxt_thread_time_string()
351 nxt_thread_time_string_no_cache(nxt_thread_t *thr, nxt_time_string_t *ts, in nxt_thread_time_string_no_cache() argument
361 if (thr == NULL || thr->time.signal <= 0) { in nxt_thread_time_string_no_cache()
400 nxt_thread_time_string_cache(nxt_thread_t *thr, nxt_atomic_uint_t slot) in nxt_thread_time_string_cache() argument
406 if (nxt_fast_path(slot < thr->time.nstrings)) { in nxt_thread_time_string_cache()
407 tsc = &thr->time.strings[slot]; in nxt_thread_time_string_cache()
415 thr->time.no_cache = 1; in nxt_thread_time_string_cache()
416 tsc = nxt_realloc(thr->time.strings, size); in nxt_thread_time_string_cache()
417 thr->time.no_cache = 0; in nxt_thread_time_string_cache()
423 for (i = thr->time.nstrings; i < nstrings; i++) { in nxt_thread_time_string_cache()
428 thr->time.strings = tsc; in nxt_thread_time_string_cache()
429 thr->time.nstrings = nstrings; in nxt_thread_time_string_cache()