/bionic/tests/ |
D | string_test.cpp | 256 StringTestState<char> state(SMALL); in TEST() local 257 for (size_t i = 1; i < state.n; i++) { in TEST() 258 for (state.BeginIterations(); state.HasNextIteration(); state.NextIteration()) { in TEST() 259 memset(state.ptr2, '\2', state.MAX_LEN); in TEST() 260 state.ptr2[state.MAX_LEN - 1] = '\0'; in TEST() 261 memcpy(state.ptr, state.ptr2, 2 * state.MAX_LEN); in TEST() 263 memset(state.ptr1, 'L', state.len[i]); in TEST() 264 state.ptr1[random() % state.len[i]] = '\0'; in TEST() 265 state.ptr1[state.len[i] - 1] = '\0'; in TEST() 267 strcpy(state.ptr + state.MAX_LEN - 1, state.ptr1); in TEST() [all …]
|
/bionic/benchmarks/ |
D | math_benchmark.cpp | 27 static void SetLabel(benchmark::State& state) { in SetLabel() argument 28 state.SetLabel(names[state.range_x()]); in SetLabel() 35 static void BM_math_sqrt(benchmark::State& state) { in BM_math_sqrt() argument 38 while (state.KeepRunning()) { in BM_math_sqrt() 44 static void BM_math_log10(benchmark::State& state) { in BM_math_log10() argument 47 while (state.KeepRunning()) { in BM_math_log10() 53 static void BM_math_logb(benchmark::State& state) { in BM_math_logb() argument 56 while (state.KeepRunning()) { in BM_math_logb() 62 static void BM_math_isfinite_macro(benchmark::State& state) { in BM_math_isfinite_macro() argument 64 v = values[state.range_x()]; in BM_math_isfinite_macro() [all …]
|
D | pthread_benchmark.cpp | 24 static void BM_pthread_self(benchmark::State& state) { in BM_pthread_self() argument 25 while (state.KeepRunning()) { in BM_pthread_self() 31 static void BM_pthread_getspecific(benchmark::State& state) { in BM_pthread_getspecific() argument 35 while (state.KeepRunning()) { in BM_pthread_getspecific() 43 static void BM_pthread_setspecific(benchmark::State& state) { in BM_pthread_setspecific() argument 47 while (state.KeepRunning()) { in BM_pthread_setspecific() 58 static void BM_pthread_once(benchmark::State& state) { in BM_pthread_once() argument 62 while (state.KeepRunning()) { in BM_pthread_once() 68 static void BM_pthread_mutex_lock(benchmark::State& state) { in BM_pthread_mutex_lock() argument 71 while (state.KeepRunning()) { in BM_pthread_mutex_lock() [all …]
|
D | string_benchmark.cpp | 30 static void BM_string_memcmp(benchmark::State& state) { in BM_string_memcmp() argument 31 const size_t nbytes = state.range_x(); in BM_string_memcmp() 37 while (state.KeepRunning()) { in BM_string_memcmp() 41 state.SetBytesProcessed(uint64_t(state.iterations()) * uint64_t(nbytes)); in BM_string_memcmp() 47 static void BM_string_memcpy(benchmark::State& state) { in BM_string_memcpy() argument 48 const size_t nbytes = state.range_x(); in BM_string_memcpy() 52 while (state.KeepRunning()) { in BM_string_memcpy() 56 state.SetBytesProcessed(uint64_t(state.iterations()) * uint64_t(nbytes)); in BM_string_memcpy() 62 static void BM_string_memmove(benchmark::State& state) { in BM_string_memmove() argument 63 const size_t nbytes = state.range_x(); in BM_string_memmove() [all …]
|
D | stdio_benchmark.cpp | 31 void ReadWriteTest(benchmark::State& state, Fn f, bool buffered) { in ReadWriteTest() argument 32 size_t chunk_size = state.range_x(); in ReadWriteTest() 42 while (state.KeepRunning()) { in ReadWriteTest() 46 state.SetBytesProcessed(int64_t(state.iterations()) * int64_t(chunk_size)); in ReadWriteTest() 51 void BM_stdio_fread(benchmark::State& state) { in BM_stdio_fread() argument 52 ReadWriteTest(state, fread, true); in BM_stdio_fread() 56 void BM_stdio_fwrite(benchmark::State& state) { in BM_stdio_fwrite() argument 57 ReadWriteTest(state, fwrite, true); in BM_stdio_fwrite() 61 void BM_stdio_fread_unbuffered(benchmark::State& state) { in BM_stdio_fread_unbuffered() argument 62 ReadWriteTest(state, fread, false); in BM_stdio_fread_unbuffered() [all …]
|
D | time_benchmark.cpp | 24 static void BM_time_clock_gettime(benchmark::State& state) { in BM_time_clock_gettime() argument 26 while (state.KeepRunning()) { in BM_time_clock_gettime() 32 static void BM_time_clock_gettime_syscall(benchmark::State& state) { in BM_time_clock_gettime_syscall() argument 34 while (state.KeepRunning()) { in BM_time_clock_gettime_syscall() 40 static void BM_time_gettimeofday(benchmark::State& state) { in BM_time_gettimeofday() argument 42 while (state.KeepRunning()) { in BM_time_gettimeofday() 48 void BM_time_gettimeofday_syscall(benchmark::State& state) { in BM_time_gettimeofday_syscall() argument 50 while (state.KeepRunning()) { in BM_time_gettimeofday_syscall() 56 void BM_time_time(benchmark::State& state) { in BM_time_time() argument 57 while (state.KeepRunning()) { in BM_time_time()
|
D | unistd_benchmark.cpp | 22 static void BM_unistd_getpid(benchmark::State& state) { in BM_unistd_getpid() argument 23 while (state.KeepRunning()) { in BM_unistd_getpid() 29 static void BM_unistd_getpid_syscall(benchmark::State& state) { in BM_unistd_getpid_syscall() argument 30 while (state.KeepRunning()) { in BM_unistd_getpid_syscall() 41 static void BM_unistd_gettid(benchmark::State& state) { in BM_unistd_gettid() argument 42 while (state.KeepRunning()) { in BM_unistd_gettid() 50 void BM_unistd_gettid_syscall(benchmark::State& state) { in BM_unistd_gettid_syscall() argument 51 while (state.KeepRunning()) { in BM_unistd_gettid_syscall()
|
D | semaphore_benchmark.cpp | 25 static void BM_semaphore_sem_getvalue(benchmark::State& state) { in BM_semaphore_sem_getvalue() argument 29 while (state.KeepRunning()) { in BM_semaphore_sem_getvalue() 36 static void BM_semaphore_sem_wait_sem_post(benchmark::State& state) { in BM_semaphore_sem_wait_sem_post() argument 40 while (state.KeepRunning()) { in BM_semaphore_sem_wait_sem_post() 117 BENCHMARK_F(SemaphoreFixture, semaphore_sem_post)(benchmark::State& state) { in BENCHMARK_F() 118 while (state.KeepRunning()) { in BENCHMARK_F() 119 state.PauseTiming(); in BENCHMARK_F() 141 state.ResumeTiming(); in BENCHMARK_F()
|
D | property_benchmark.cpp | 144 static void BM_property_get(benchmark::State& state) { in BM_property_get() argument 145 const size_t nprops = state.range_x(); in BM_property_get() 150 while (state.KeepRunning()) { in BM_property_get() 157 static void BM_property_find(benchmark::State& state) { in BM_property_find() argument 158 const size_t nprops = state.range_x(); in BM_property_find() 163 while (state.KeepRunning()) { in BM_property_find() 169 static void BM_property_read(benchmark::State& state) { in BM_property_read() argument 170 const size_t nprops = state.range_x(); in BM_property_read() 183 while (state.KeepRunning()) { in BM_property_read() 192 static void BM_property_serial(benchmark::State& state) { in BM_property_serial() argument [all …]
|
/bionic/libc/bionic/ |
D | mbrtoc16.cpp | 36 static inline bool mbspartialc16(const mbstate_t* state) { in mbspartialc16() argument 37 return mbstate_get_byte(state, 3) != 0; in mbspartialc16() 41 size_t nconv, mbstate_t* state) { in begin_surrogate() argument 45 mbstate_set_byte(state, 0, trail & 0x00ff); in begin_surrogate() 46 mbstate_set_byte(state, 1, (trail & 0xff00) >> 8); in begin_surrogate() 47 mbstate_set_byte(state, 3, nconv & 0xff); in begin_surrogate() 54 static size_t finish_surrogate(char16_t* pc16, mbstate_t* state) { in finish_surrogate() argument 55 char16_t trail = mbstate_get_byte(state, 1) << 8 | in finish_surrogate() 56 mbstate_get_byte(state, 0); in finish_surrogate() 58 return reset_and_return(mbstate_get_byte(state, 3), state); in finish_surrogate() [all …]
|
D | stubs.cpp | 70 static void init_group_state(group_state_t* state) { in init_group_state() argument 71 memset(state, 0, sizeof(group_state_t)); in init_group_state() 72 state->group_.gr_mem = state->group_members_; in init_group_state() 143 static passwd* android_iinfo_to_passwd(passwd_state_t* state, in android_iinfo_to_passwd() argument 145 snprintf(state->name_buffer_, sizeof(state->name_buffer_), "%s", iinfo->name); in android_iinfo_to_passwd() 146 snprintf(state->dir_buffer_, sizeof(state->dir_buffer_), "/"); in android_iinfo_to_passwd() 147 snprintf(state->sh_buffer_, sizeof(state->sh_buffer_), "/system/bin/sh"); in android_iinfo_to_passwd() 149 passwd* pw = &state->passwd_; in android_iinfo_to_passwd() 150 pw->pw_name = state->name_buffer_; in android_iinfo_to_passwd() 153 pw->pw_dir = state->dir_buffer_; in android_iinfo_to_passwd() [all …]
|
D | c16rtomb.cpp | 45 mbstate_t* state = (ps == NULL) ? &__private_state : ps; in c16rtomb() local 46 if (mbsinit(state)) { in c16rtomb() 49 mbstate_set_byte(state, 3, (c32 & 0xff0000) >> 16); in c16rtomb() 50 mbstate_set_byte(state, 2, (c32 & 0x00ff00) >> 8); in c16rtomb() 53 return reset_and_return_illegal(EINVAL, state); in c16rtomb() 55 return c32rtomb(s, static_cast<char32_t>(c16), state); in c16rtomb() 59 return reset_and_return_illegal(EINVAL, state); in c16rtomb() 62 char32_t c32 = ((mbstate_get_byte(state, 3) << 16) | in c16rtomb() 63 (mbstate_get_byte(state, 2) << 8) | in c16rtomb() 65 return reset_and_return(c32rtomb(s, c32, NULL), state); in c16rtomb()
|
D | mbrtoc32.cpp | 38 mbstate_t* state = (ps == NULL) ? &__private_state : ps; in mbrtoc32() local 43 if (mbstate_get_byte(state, 3) != 0) { in mbrtoc32() 44 return reset_and_return_illegal(EINVAL, state); in mbrtoc32() 58 if (mbsinit(state) && (((ch = static_cast<uint8_t>(*s)) & ~0x7f) == 0)) { in mbrtoc32() 81 size_t bytes_so_far = mbstate_bytes_so_far(state); in mbrtoc32() 82 ch = bytes_so_far > 0 ? mbstate_get_byte(state, 0) : static_cast<uint8_t>(*s); in mbrtoc32() 101 return reset_and_return_illegal(EILSEQ, state); in mbrtoc32() 108 if (!mbsinit(state) && ((*s & 0xc0) != 0x80)) { in mbrtoc32() 110 return reset_and_return_illegal(EILSEQ, state); in mbrtoc32() 112 mbstate_set_byte(state, bytes_so_far + i, *s++); in mbrtoc32() [all …]
|
D | __cxa_guard.cpp | 55 atomic_int state; member 64 atomic_int state; member 82 int old_value = atomic_load_explicit(&gv->state, memory_order_relaxed); in __cxa_guard_acquire() 92 if (!atomic_compare_exchange_weak_explicit(&gv->state, &old_value, in __cxa_guard_acquire() 104 if (!atomic_compare_exchange_weak_explicit(&gv->state, &old_value, in __cxa_guard_acquire() 112 __futex_wait_ex(&gv->state, false, CONSTRUCTION_UNDERWAY_WITH_WAITER, false, nullptr); in __cxa_guard_acquire() 113 old_value = atomic_load_explicit(&gv->state, memory_order_relaxed); in __cxa_guard_acquire() 120 int old_value = atomic_exchange_explicit(&gv->state, CONSTRUCTION_COMPLETE, memory_order_release); in __cxa_guard_release() 122 __futex_wake_ex(&gv->state, false, INT_MAX); in __cxa_guard_release() 129 …int old_value = atomic_exchange_explicit(&gv->state, CONSTRUCTION_NOT_YET_STARTED, memory_order_re… in __cxa_guard_abort() [all …]
|
D | wchar.cpp | 62 mbstate_t* state = (ps == NULL) ? &__private_state : ps; in mbrtowc() local 65 return mbrtoc32(reinterpret_cast<char32_t*>(pwc), s, n, state); in mbrtowc() 70 mbstate_t* state = (ps == NULL) ? &__private_state : ps; in mbsnrtowcs() local 79 if ((nmc > 0) && (mbstate_bytes_so_far(state) > 0) in mbsnrtowcs() 81 return reset_and_return_illegal(EILSEQ, state); in mbsnrtowcs() 88 return reset_and_return(o, state); in mbsnrtowcs() 92 r = mbrtowc(NULL, *src + i, nmc - i, state); in mbsnrtowcs() 94 return reset_and_return_illegal(EILSEQ, state); in mbsnrtowcs() 97 return reset_and_return_illegal(EILSEQ, state); in mbsnrtowcs() 101 return reset_and_return(o, state); in mbsnrtowcs() [all …]
|
D | pthread_rwlock.cpp | 158 atomic_int state; member 184 static inline __always_inline bool __state_owned_by_writer(int state) { in __state_owned_by_writer() argument 185 return state < 0; in __state_owned_by_writer() 188 static inline __always_inline bool __state_owned_by_readers(int state) { in __state_owned_by_readers() argument 191 return state >= STATE_READER_COUNT_CHANGE_STEP; in __state_owned_by_readers() 194 static inline __always_inline bool __state_owned_by_readers_or_writer(int state) { in __state_owned_by_readers_or_writer() argument 195 return state < 0 || state >= STATE_READER_COUNT_CHANGE_STEP; in __state_owned_by_readers_or_writer() 198 static inline __always_inline int __state_add_writer_flag(int state) { in __state_add_writer_flag() argument 199 return state | STATE_OWNED_BY_WRITER_FLAG; in __state_add_writer_flag() 202 static inline __always_inline bool __state_is_last_reader(int state) { in __state_is_last_reader() argument [all …]
|
D | pthread_barrier.cpp | 72 _Atomic(BarrierState) state; 98 atomic_init(&barrier->state, WAIT); in pthread_barrier_init() 120 while(atomic_load_explicit(&barrier->state, memory_order_acquire) == RELEASE) { in pthread_barrier_wait() 121 __futex_wait_ex(&barrier->state, barrier->pshared, RELEASE, false, nullptr); in pthread_barrier_wait() 148 atomic_store_explicit(&barrier->state, RELEASE, memory_order_release); in pthread_barrier_wait() 149 __futex_wake_ex(&barrier->state, barrier->pshared, prev_wait_count); in pthread_barrier_wait() 154 while (atomic_load_explicit(&barrier->state, memory_order_acquire) == WAIT) { in pthread_barrier_wait() 155 __futex_wait_ex(&barrier->state, barrier->pshared, WAIT, false, nullptr); in pthread_barrier_wait() 162 atomic_store_explicit(&barrier->state, WAIT, memory_order_release); in pthread_barrier_wait() 163 __futex_wake_ex(&barrier->state, barrier->pshared, barrier->init_count); in pthread_barrier_wait() [all …]
|
D | c32rtomb.cpp | 37 mbstate_t* state = (ps == NULL) ? &__private_state : ps; in c32rtomb() local 41 return reset_and_return(1, state); in c32rtomb() 50 reset_and_return(1, state); in c32rtomb() 53 if (!mbsinit(state)) { in c32rtomb() 54 return reset_and_return_illegal(EILSEQ, state); in c32rtomb()
|
D | pthread_mutex.cpp | 219 _Atomic(uint16_t) state; 247 atomic_init(&mutex->state, MUTEX_TYPE_BITS_NORMAL); in pthread_mutex_init() 251 uint16_t state = 0; in pthread_mutex_init() local 253 state |= MUTEX_SHARED_MASK; in pthread_mutex_init() 258 state |= MUTEX_TYPE_BITS_NORMAL; in pthread_mutex_init() 261 state |= MUTEX_TYPE_BITS_RECURSIVE; in pthread_mutex_init() 264 state |= MUTEX_TYPE_BITS_ERRORCHECK; in pthread_mutex_init() 270 atomic_init(&mutex->state, state); in pthread_mutex_init() 281 if (__predict_true(atomic_compare_exchange_strong_explicit(&mutex->state, &old_state, in __pthread_normal_mutex_trylock() 325 while (atomic_exchange_explicit(&mutex->state, locked_contended, in __pthread_normal_mutex_lock() [all …]
|
D | pthread_cond.cpp | 108 atomic_uint state; member 111 return COND_IS_SHARED(atomic_load_explicit(&state, memory_order_relaxed)); in process_shared() 115 return COND_GET_CLOCK(atomic_load_explicit(&state, memory_order_relaxed)) == CLOCK_REALTIME; in use_realtime_clock() 142 atomic_init(&cond->state, init_state); in pthread_cond_init() 149 atomic_store_explicit(&cond->state, 0xdeadc04d, memory_order_relaxed); in pthread_cond_destroy() 167 atomic_fetch_add_explicit(&cond->state, COND_COUNTER_STEP, memory_order_relaxed); in __pthread_cond_pulse() 169 __futex_wake_ex(&cond->state, cond->process_shared(), thread_count); in __pthread_cond_pulse() 180 unsigned int old_state = atomic_load_explicit(&cond->state, memory_order_relaxed); in __pthread_cond_timedwait() 182 int status = __futex_wait_ex(&cond->state, cond->process_shared(), old_state, in __pthread_cond_timedwait()
|
/bionic/libc/private/ |
D | bionic_lock.h | 44 _Atomic(LockState) state; 49 atomic_init(&state, Unlocked); in init() 55 return __predict_true(atomic_compare_exchange_strong_explicit(&state, &old_state, in trylock() 61 if (__predict_true(atomic_compare_exchange_strong_explicit(&state, &old_state, in lock() 65 while (atomic_exchange_explicit(&state, LockedWithWaiter, memory_order_acquire) != Unlocked) { in lock() 67 __futex_wait_ex(&state, process_shared, LockedWithWaiter, false, nullptr); in lock() 73 if (atomic_exchange_explicit(&state, Unlocked, memory_order_release) == LockedWithWaiter) { in unlock() 74 __futex_wake_ex(&state, process_shared, 1); in unlock()
|
/bionic/libc/upstream-netbsd/common/lib/libc/stdlib/ |
D | random.c | 248 static int *state = &randtbl[1]; variable 272 state[0] = x; in srandom_unlocked() 274 state[0] = x; in srandom_unlocked() 286 x1 = state[i - 1]; in srandom_unlocked() 292 state[i] = t; in srandom_unlocked() 294 state[i] = 1103515245 * state[i - 1] + 12345; in srandom_unlocked() 297 fptr = &state[rand_sep]; in srandom_unlocked() 298 rptr = &state[0]; in srandom_unlocked() 342 void *ostate = (void *)(&state[-1]); in initstate() 351 state[-1] = rand_type; in initstate() [all …]
|
/bionic/libc/dns/net/ |
D | base64.c | 221 int state, ch; local 227 state = 0; 241 switch (state) { 248 state = 1; 260 state = 2; 272 state = 3; 281 state = 0; 295 switch (state) { 335 if (state != 0)
|
/bionic/libc/malloc_debug/ |
D | backtrace.cpp | 83 stack_crawl_state_t* state = static_cast<stack_crawl_state_t*>(arg); in trace_function() local 124 state->frames[state->cur_frame++] = ip; in trace_function() 125 return (state->cur_frame >= state->frame_count) ? _URC_END_OF_STACK : _URC_NO_REASON; in trace_function() 129 stack_crawl_state_t state(frames, frame_count); in backtrace_get() local 130 _Unwind_Backtrace(trace_function, &state); in backtrace_get() 131 return state.cur_frame; in backtrace_get()
|
/bionic/libc/upstream-openbsd/lib/libc/stdio/ |
D | fmemopen.c | 27 struct state { struct 38 struct state *st = v; in fmemopen_read() argument 51 struct state *st = v; in fmemopen_write() 73 struct state *st = v; in fmemopen_seek() 108 struct state *st = v; in fmemopen_close_free() 119 struct state *st; in fmemopen()
|