/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 | string_benchmark.cpp | 24 static void BM_string_memcmp(benchmark::State& state) { in BM_string_memcmp() argument 25 const size_t nbytes = state.range(0); in BM_string_memcmp() 26 const size_t src_alignment = state.range(1); in BM_string_memcmp() 27 const size_t dst_alignment = state.range(2); in BM_string_memcmp() 35 while (state.KeepRunning()) { in BM_string_memcmp() 39 state.SetBytesProcessed(uint64_t(state.iterations()) * uint64_t(nbytes)); in BM_string_memcmp() 43 static void BM_string_memcpy(benchmark::State& state) { in BM_string_memcpy() argument 44 const size_t nbytes = state.range(0); in BM_string_memcpy() 45 const size_t src_alignment = state.range(1); in BM_string_memcpy() 46 const size_t dst_alignment = state.range(2); in BM_string_memcpy() [all …]
|
D | math_benchmark.cpp | 26 static void SetLabel(benchmark::State& state) { in SetLabel() argument 27 state.SetLabel(names[state.range(0)]); in SetLabel() 38 static void BM_math_sqrt(benchmark::State& state) { in BM_math_sqrt() argument 41 while (state.KeepRunning()) { in BM_math_sqrt() 47 static void BM_math_log10(benchmark::State& state) { in BM_math_log10() argument 50 while (state.KeepRunning()) { in BM_math_log10() 56 static void BM_math_logb(benchmark::State& state) { in BM_math_logb() argument 59 while (state.KeepRunning()) { in BM_math_logb() 65 static void BM_math_isfinite_macro(benchmark::State& state) { in BM_math_isfinite_macro() argument 67 v = values[state.range(0)]; in BM_math_isfinite_macro() [all …]
|
D | malloc_map_benchmark.cpp | 64 static void MapBenchmark(benchmark::State& state, size_t num_elements) { in MapBenchmark() argument 69 for (auto _ : state) { in MapBenchmark() 71 state.PauseTiming(); in MapBenchmark() 75 state.ResumeTiming(); in MapBenchmark() 82 state.PauseTiming(); in MapBenchmark() 87 state.ResumeTiming(); in MapBenchmark() 92 double rss_mb = (rss_bytes / static_cast<double>(state.iterations())) / 1024.0 / 1024.0; in MapBenchmark() 93 state.counters["RSS_MB"] = rss_mb; in MapBenchmark() 97 static void BM_std_map_8(benchmark::State& state) { in BM_std_map_8() argument 98 MapBenchmark<std::map<uint64_t, char[8]>>(state, 1000000); in BM_std_map_8() [all …]
|
D | time_benchmark.cpp | 25 static void BM_time_clock_gettime(benchmark::State& state) { in BM_time_clock_gettime() argument 28 while (state.KeepRunning()) { in BM_time_clock_gettime() 34 static void BM_time_clock_gettime_syscall(benchmark::State& state) { in BM_time_clock_gettime_syscall() argument 37 while (state.KeepRunning()) { in BM_time_clock_gettime_syscall() 43 static void BM_time_clock_gettime_MONOTONIC_COARSE(benchmark::State& state) { in BM_time_clock_gettime_MONOTONIC_COARSE() argument 46 while (state.KeepRunning()) { in BM_time_clock_gettime_MONOTONIC_COARSE() 52 static void BM_time_clock_gettime_MONOTONIC_RAW(benchmark::State& state) { in BM_time_clock_gettime_MONOTONIC_RAW() argument 55 while (state.KeepRunning()) { in BM_time_clock_gettime_MONOTONIC_RAW() 61 static void BM_time_clock_gettime_REALTIME(benchmark::State& state) { in BM_time_clock_gettime_REALTIME() argument 64 while (state.KeepRunning()) { in BM_time_clock_gettime_REALTIME() [all …]
|
D | pthread_benchmark.cpp | 25 static void BM_pthread_self(benchmark::State& state) { in BM_pthread_self() argument 26 while (state.KeepRunning()) { in BM_pthread_self() 32 static void BM_pthread_getspecific(benchmark::State& state) { in BM_pthread_getspecific() argument 36 while (state.KeepRunning()) { in BM_pthread_getspecific() 44 static void BM_pthread_setspecific(benchmark::State& state) { in BM_pthread_setspecific() argument 48 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 | stdio_benchmark.cpp | 38 void ReadWriteTest(benchmark::State& state, Fn f, bool buffered) { in ReadWriteTest() argument 39 size_t chunk_size = state.range(0); in ReadWriteTest() 49 while (state.KeepRunning()) { in ReadWriteTest() 55 state.SetBytesProcessed(int64_t(state.iterations()) * int64_t(chunk_size)); in ReadWriteTest() 60 void BM_stdio_fread(benchmark::State& state) { in BM_stdio_fread() argument 61 ReadWriteTest(state, fread, true); in BM_stdio_fread() 65 void BM_stdio_fwrite(benchmark::State& state) { in BM_stdio_fwrite() argument 66 ReadWriteTest(state, fwrite, true); in BM_stdio_fwrite() 70 void BM_stdio_fread_unbuffered(benchmark::State& state) { in BM_stdio_fread_unbuffered() argument 71 ReadWriteTest(state, fread, false); in BM_stdio_fread_unbuffered() [all …]
|
D | stdlib_benchmark.cpp | 27 static void MallocFree(benchmark::State& state) { in MallocFree() argument 28 const size_t nbytes = state.range(0); in MallocFree() 31 for (auto _ : state) { in MallocFree() 38 state.SetBytesProcessed(uint64_t(state.iterations()) * uint64_t(nbytes)); in MallocFree() 41 static void BM_stdlib_malloc_free_default(benchmark::State& state) { in BM_stdlib_malloc_free_default() argument 47 MallocFree(state); in BM_stdlib_malloc_free_default() 52 static void BM_stdlib_malloc_free_decay1(benchmark::State& state) { in BM_stdlib_malloc_free_decay1() argument 55 MallocFree(state); in BM_stdlib_malloc_free_decay1() 62 static void CallocFree(benchmark::State& state) { in CallocFree() argument 63 const size_t nbytes = state.range(0); in CallocFree() [all …]
|
D | atomic_benchmark.cpp | 48 void BM_atomic_empty(benchmark::State& state) { in BM_atomic_empty() argument 49 while (state.KeepRunning()) { in BM_atomic_empty() 55 static void BM_atomic_load_relaxed(benchmark::State& state) { in BM_atomic_load_relaxed() argument 57 while (state.KeepRunning()) { in BM_atomic_load_relaxed() 65 static void BM_atomic_load_acquire(benchmark::State& state) { in BM_atomic_load_acquire() argument 67 while (state.KeepRunning()) { in BM_atomic_load_acquire() 75 static void BM_atomic_store_release(benchmark::State& state) { in BM_atomic_store_release() argument 77 while (state.KeepRunning()) { in BM_atomic_store_release() 84 static void BM_atomic_store_seq_cst(benchmark::State& state) { in BM_atomic_store_seq_cst() argument 86 while (state.KeepRunning()) { in BM_atomic_store_seq_cst() [all …]
|
D | property_benchmark.cpp | 127 static void BM_property_get(benchmark::State& state) { in BM_property_get() argument 128 const size_t nprops = state.range(0); in BM_property_get() 133 while (state.KeepRunning()) { in BM_property_get() 140 static void BM_property_find(benchmark::State& state) { in BM_property_find() argument 141 const size_t nprops = state.range(0); in BM_property_find() 146 while (state.KeepRunning()) { in BM_property_find() 152 static void BM_property_read(benchmark::State& state) { in BM_property_read() argument 153 const size_t nprops = state.range(0); in BM_property_read() 166 while (state.KeepRunning()) { in BM_property_read() 175 static void BM_property_serial(benchmark::State& state) { in BM_property_serial() argument [all …]
|
D | unistd_benchmark.cpp | 41 void BM_unistd_fork_call(benchmark::State& state) { in BM_unistd_fork_call() argument 42 for (auto _ : state) { in BM_unistd_fork_call() 50 state.PauseTiming(); in BM_unistd_fork_call() 53 state.SkipWithError(err.c_str()); in BM_unistd_fork_call() 59 state.SkipWithError(err.c_str()); in BM_unistd_fork_call() 63 state.SkipWithError(err.c_str()); in BM_unistd_fork_call() 66 state.ResumeTiming(); in BM_unistd_fork_call()
|
/bionic/libc/bionic/ |
D | grp_pwd.cpp | 77 static void init_group_state(group_state_t* state) { in init_group_state() argument 78 memset(state, 0, sizeof(group_state_t) - sizeof(state->getgrent_idx)); in init_group_state() 79 state->group_.gr_name = state->group_name_buffer_; in init_group_state() 80 state->group_.gr_mem = state->group_members_; in init_group_state() 81 state->group_.gr_mem[0] = state->group_.gr_name; in init_group_state() 90 static void init_passwd_state(passwd_state_t* state) { in init_passwd_state() argument 91 memset(state, 0, sizeof(passwd_state_t) - sizeof(state->getpwent_idx)); in init_passwd_state() 92 state->passwd_.pw_name = state->name_buffer_; in init_passwd_state() 93 state->passwd_.pw_dir = state->dir_buffer_; in init_passwd_state() 94 state->passwd_.pw_shell = state->sh_buffer_; in init_passwd_state() [all …]
|
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 mbstate_reset_and_return(mbstate_get_byte(state, 3), state); in finish_surrogate() [all …]
|
D | wchar.cpp | 62 mbstate_t* state = (ps == nullptr) ? &__private_state : ps; in mbrtowc() local 65 return mbrtoc32(reinterpret_cast<char32_t*>(pwc), s, n, state); in mbrtowc() 70 mbstate_t* state = (ps == nullptr) ? &__private_state : ps; in mbsnrtowcs() local 76 if (nmc > 0 && mbstate_bytes_so_far(state) > 0 && static_cast<uint8_t>((*src)[0]) < 0x80) { in mbsnrtowcs() 77 return mbstate_reset_and_return_illegal(EILSEQ, state); in mbsnrtowcs() 86 return mbstate_reset_and_return(o, state); in mbsnrtowcs() 90 r = mbrtowc(nullptr, *src + i, nmc - i, state); in mbsnrtowcs() 92 return mbstate_reset_and_return_illegal(EILSEQ, state); in mbsnrtowcs() 95 return mbstate_reset_and_return_illegal(EILSEQ, state); in mbsnrtowcs() 98 return mbstate_reset_and_return(o, state); in mbsnrtowcs() [all …]
|
D | mbrtoc32.cpp | 38 mbstate_t* state = (ps == nullptr) ? &__private_state : ps; in mbrtoc32() local 43 if (mbstate_get_byte(state, 3) != 0) { in mbrtoc32() 44 return mbstate_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 mbstate_reset_and_return_illegal(EILSEQ, state); in mbrtoc32() 108 if (!mbsinit(state) && ((*s & 0xc0) != 0x80)) { in mbrtoc32() 110 return mbstate_reset_and_return_illegal(EILSEQ, state); in mbrtoc32() 112 mbstate_set_byte(state, bytes_so_far + i, *s++); in mbrtoc32() [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 | __cxa_guard.cpp | 53 atomic_int state; member 62 atomic_int state; member 80 int old_value = atomic_load_explicit(&gv->state, memory_order_acquire); in __cxa_guard_acquire() 89 if (!atomic_compare_exchange_weak_explicit(&gv->state, &old_value, in __cxa_guard_acquire() 97 if (!atomic_compare_exchange_weak_explicit(&gv->state, &old_value, in __cxa_guard_acquire() 105 __futex_wait_ex(&gv->state, false, CONSTRUCTION_UNDERWAY_WITH_WAITER); in __cxa_guard_acquire() 106 old_value = atomic_load_explicit(&gv->state, memory_order_acquire); in __cxa_guard_acquire() 113 int old_value = atomic_exchange_explicit(&gv->state, CONSTRUCTION_COMPLETE, memory_order_release); in __cxa_guard_release() 115 __futex_wake_ex(&gv->state, false, INT_MAX); in __cxa_guard_release() 122 …int old_value = atomic_exchange_explicit(&gv->state, CONSTRUCTION_NOT_YET_STARTED, memory_order_re… in __cxa_guard_abort() [all …]
|
D | c16rtomb.cpp | 45 mbstate_t* state = (ps == nullptr) ? &__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 mbstate_reset_and_return_illegal(EINVAL, state); in c16rtomb() 55 return c32rtomb(s, static_cast<char32_t>(c16), state); in c16rtomb() 59 return mbstate_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 mbstate_reset_and_return(c32rtomb(s, c32, nullptr), state); in c16rtomb()
|
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 | pthread_mutex.cpp | 455 _Atomic(uint16_t) state; 473 _Atomic(uint16_t) state; 507 atomic_init(&mutex->state, MUTEX_TYPE_BITS_NORMAL); in pthread_mutex_init() 511 uint16_t state = 0; in pthread_mutex_init() local 513 state |= MUTEX_SHARED_MASK; in pthread_mutex_init() 518 state |= MUTEX_TYPE_BITS_NORMAL; in pthread_mutex_init() 521 state |= MUTEX_TYPE_BITS_RECURSIVE; in pthread_mutex_init() 524 state |= MUTEX_TYPE_BITS_ERRORCHECK; in pthread_mutex_init() 532 if (state & MUTEX_SHARED_MASK) { in pthread_mutex_init() 541 atomic_init(&mutex->state, PI_MUTEX_STATE); in pthread_mutex_init() [all …]
|
/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/stdio/ |
D | parsefloat.c | 46 } state = S_START; in parsefloat() local 63 switch (state) { in parsefloat() 65 state = S_GOTSIGN; in parsefloat() 73 state = S_MAYBEHEX; in parsefloat() 78 state = S_INF; in parsefloat() 82 state = S_NAN; in parsefloat() 85 state = S_DIGITS; in parsefloat() 127 state = S_DIGITS; in parsefloat() 139 state = S_FRAC; in parsefloat() 152 state = S_EXP; in parsefloat() [all …]
|
/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); in lock() 74 if (atomic_exchange_explicit(&state, Unlocked, memory_order_release) == LockedWithWaiter) { in unlock() 81 __futex_wake_ex(&state, shared, 1); in unlock()
|
/bionic/libc/upstream-openbsd/lib/libc/net/ |
D | base64.c | 195 int tarindex, state, ch; local 199 state = 0; 213 switch (state) { 220 state = 1; 234 state = 2; 248 state = 3; 257 state = 0; 269 switch (state) { 310 if (state != 0)
|
/bionic/benchmarks/spawn/ |
D | spawn_benchmark.cpp | 41 void BM_spawn_test(benchmark::State& state, const char* const* argv) { in BM_spawn_test() argument 42 for (auto _ : state) { in BM_spawn_test() 46 state.SkipWithError(android::base::StringPrintf( in BM_spawn_test() 54 state.SkipWithError(android::base::StringPrintf( in BM_spawn_test() 60 state.SkipWithError(android::base::StringPrintf("could not exec %s", argv[0]).c_str()); in BM_spawn_test()
|