/bionic/tests/ |
D | string_test.cpp | 267 StringTestState<char> state(SMALL); in TEST() local 268 for (size_t i = 1; i < state.n; i++) { in TEST() 269 for (state.BeginIterations(); state.HasNextIteration(); state.NextIteration()) { in TEST() 270 memset(state.ptr2, '\2', state.MAX_LEN); in TEST() 271 state.ptr2[state.MAX_LEN - 1] = '\0'; in TEST() 272 memcpy(state.ptr, state.ptr2, 2 * state.MAX_LEN); in TEST() 274 memset(state.ptr1, 'L', state.len[i]); in TEST() 275 state.ptr1[random() % state.len[i]] = '\0'; in TEST() 276 state.ptr1[state.len[i] - 1] = '\0'; in TEST() 278 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() 34 while (state.KeepRunning()) { in BM_string_memcmp() 38 state.SetBytesProcessed(uint64_t(state.iterations()) * uint64_t(nbytes)); in BM_string_memcmp() 42 static void BM_string_memcpy(benchmark::State& state) { in BM_string_memcpy() argument 43 const size_t nbytes = state.range(0); in BM_string_memcpy() 44 const size_t src_alignment = state.range(1); in BM_string_memcpy() 45 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 | syscall_mm_benchmark.cpp | 48 void MmapBenchmarkImpl(benchmark::State& state, const struct MmapParams& params, int fd, in MmapBenchmarkImpl() argument 50 for (auto _ : state) { in MmapBenchmarkImpl() 51 if (type == kBenchmarkMunmapOnly) state.PauseTiming(); in MmapBenchmarkImpl() 54 state.SkipWithError(android::base::StringPrintf("mmap failed: %s", strerror(errno)).c_str()); in MmapBenchmarkImpl() 58 if (type == kBenchmarkMmapOnly) state.PauseTiming(); in MmapBenchmarkImpl() 64 if (type == kBenchmarkMunmapOnly) state.ResumeTiming(); in MmapBenchmarkImpl() 67 state.SkipWithError( in MmapBenchmarkImpl() 71 if (type == kBenchmarkMmapOnly) state.ResumeTiming(); in MmapBenchmarkImpl() 75 static void MmapBenchmark(benchmark::State& state, const struct MmapParams& params, int fd, in MmapBenchmark() argument 77 MmapBenchmarkImpl<kBenchmarkAll>(state, params, fd, area); in MmapBenchmark() [all …]
|
D | stdlib_benchmark.cpp | 28 static void MallocFree(benchmark::State& state) { in MallocFree() argument 29 const size_t nbytes = state.range(0); in MallocFree() 32 for (auto _ : state) { in MallocFree() 39 state.SetBytesProcessed(uint64_t(state.iterations()) * uint64_t(nbytes)); in MallocFree() 42 static void BM_stdlib_malloc_free_default(benchmark::State& state) { in BM_stdlib_malloc_free_default() argument 50 MallocFree(state); in BM_stdlib_malloc_free_default() 55 static void BM_stdlib_malloc_free_decay1(benchmark::State& state) { in BM_stdlib_malloc_free_decay1() argument 60 MallocFree(state); in BM_stdlib_malloc_free_decay1() 65 static void CallocFree(benchmark::State& state) { in CallocFree() argument 66 const size_t nbytes = state.range(0); in CallocFree() [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 | 40 static void BM_time_clock_gettime(benchmark::State& state) { in BM_time_clock_gettime() argument 43 while (state.KeepRunning()) { in BM_time_clock_gettime() 49 static void BM_time_clock_gettime_syscall(benchmark::State& state) { in BM_time_clock_gettime_syscall() argument 52 while (state.KeepRunning()) { in BM_time_clock_gettime_syscall() 58 static void BM_time_clock_gettime_MONOTONIC_COARSE(benchmark::State& state) { in BM_time_clock_gettime_MONOTONIC_COARSE() argument 61 while (state.KeepRunning()) { in BM_time_clock_gettime_MONOTONIC_COARSE() 67 static void BM_time_clock_gettime_MONOTONIC_RAW(benchmark::State& state) { in BM_time_clock_gettime_MONOTONIC_RAW() argument 70 while (state.KeepRunning()) { in BM_time_clock_gettime_MONOTONIC_RAW() 76 static void BM_time_clock_gettime_REALTIME(benchmark::State& state) { in BM_time_clock_gettime_REALTIME() argument 79 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 | atomic_benchmark.cpp | 50 void BM_atomic_empty(benchmark::State& state) { in BM_atomic_empty() argument 51 while (state.KeepRunning()) { in BM_atomic_empty() 57 static void BM_atomic_load_relaxed(benchmark::State& state) { in BM_atomic_load_relaxed() argument 59 while (state.KeepRunning()) { in BM_atomic_load_relaxed() 67 static void BM_atomic_load_acquire(benchmark::State& state) { in BM_atomic_load_acquire() argument 69 while (state.KeepRunning()) { in BM_atomic_load_acquire() 77 static void BM_atomic_store_release(benchmark::State& state) { in BM_atomic_store_release() argument 79 while (state.KeepRunning()) { in BM_atomic_store_release() 86 static void BM_atomic_store_seq_cst(benchmark::State& state) { in BM_atomic_store_seq_cst() argument 88 while (state.KeepRunning()) { in BM_atomic_store_seq_cst() [all …]
|
D | malloc_benchmark.cpp | 44 static void RunMalloptPurge(benchmark::State& state, int purge_value) { in RunMalloptPurge() argument 51 for (auto _ : state) { in RunMalloptPurge() 52 state.PauseTiming(); in RunMalloptPurge() 59 state.SkipWithError("Failed to allocate memory"); in RunMalloptPurge() 71 state.ResumeTiming(); in RunMalloptPurge() 77 static void RunThreadsThroughput(benchmark::State& state, size_t size, size_t num_threads) { in RunThreadsThroughput() argument 134 for (auto _ : state) { in RunThreadsThroughput() 135 state.PauseTiming(); in RunThreadsThroughput() 141 state.ResumeTiming(); in RunThreadsThroughput() 157 state.SetBytesProcessed(ThreadsBytesProcessed * static_cast<size_t>(state.iterations())); in RunThreadsThroughput() [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()
|
D | property_benchmark.cpp | 131 static void BM_property_get(benchmark::State& state) { in BM_property_get() argument 132 const size_t nprops = state.range(0); in BM_property_get() 137 while (state.KeepRunning()) { in BM_property_get() 144 static void BM_property_find(benchmark::State& state) { in BM_property_find() argument 145 const size_t nprops = state.range(0); in BM_property_find() 150 while (state.KeepRunning()) { in BM_property_find() 156 static void BM_property_read(benchmark::State& state) { in BM_property_read() argument 157 const size_t nprops = state.range(0); in BM_property_read() 170 while (state.KeepRunning()) { in BM_property_read() 179 static void BM_property_serial(benchmark::State& state) { in BM_property_serial() argument [all …]
|
/bionic/libc/bionic/ |
D | grp_pwd.cpp | 83 static void init_group_state(group_state_t* state) { in init_group_state() argument 84 memset(state, 0, sizeof(group_state_t) - sizeof(state->getgrent_idx)); in init_group_state() 85 state->group_.gr_name = state->group_name_buffer_; in init_group_state() 86 state->group_.gr_mem = state->group_members_; in init_group_state() 87 state->group_.gr_mem[0] = state->group_.gr_name; in init_group_state() 96 static void init_passwd_state(passwd_state_t* state) { in init_passwd_state() argument 97 memset(state, 0, sizeof(passwd_state_t) - sizeof(state->getpwent_idx)); in init_passwd_state() 98 state->passwd_.pw_name = state->name_buffer_; in init_passwd_state() 99 state->passwd_.pw_dir = state->dir_buffer_; in init_passwd_state() 100 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() 74 static size_t finish_surrogate(char16_t* pc16, mbstate_t* state) { in finish_surrogate() argument 75 char16_t trail = mbstate_get_byte(state, 1) << 8 | in finish_surrogate() 76 mbstate_get_byte(state, 0); in finish_surrogate() 78 mbstate_reset(state); in finish_surrogate() [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() 72 if (mbstate_is_initial(state) && (((ch = static_cast<uint8_t>(*s)) & ~0x7f) == 0)) { in mbrtoc32() 95 size_t bytes_so_far = mbstate_bytes_so_far(state); in mbrtoc32() 96 ch = bytes_so_far > 0 ? mbstate_get_byte(state, 0) : static_cast<uint8_t>(*s); in mbrtoc32() 112 return mbstate_reset_and_return_illegal(EILSEQ, state); in mbrtoc32() 119 if (!mbstate_is_initial(state) && ((*s & 0xc0) != 0x80)) { in mbrtoc32() 121 return mbstate_reset_and_return_illegal(EILSEQ, state); in mbrtoc32() 123 mbstate_set_byte(state, bytes_so_far + i, *s++); in mbrtoc32() [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 | __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 (mbstate_is_initial(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_rwlock.cpp | 159 atomic_int state; member 185 static inline __always_inline bool __state_owned_by_writer(int state) { in __state_owned_by_writer() argument 186 return state < 0; in __state_owned_by_writer() 189 static inline __always_inline bool __state_owned_by_readers(int state) { in __state_owned_by_readers() argument 192 return state >= STATE_READER_COUNT_CHANGE_STEP; in __state_owned_by_readers() 195 static inline __always_inline bool __state_owned_by_readers_or_writer(int state) { in __state_owned_by_readers_or_writer() argument 196 return state < 0 || state >= STATE_READER_COUNT_CHANGE_STEP; in __state_owned_by_readers_or_writer() 199 static inline __always_inline int __state_add_writer_flag(int state) { in __state_add_writer_flag() argument 200 return state | STATE_OWNED_BY_WRITER_FLAG; in __state_add_writer_flag() 203 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 …]
|
/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/dns/resolv/ |
D | res_data.cpp | 42 return &state; in get() 48 static __res_state state; member in GlobalStateAccessor 52 __res_state GlobalStateAccessor::state; member in GlobalStateAccessor 73 if (!state.retrans) state.retrans = RES_TIMEOUT; in init() 74 if (!state.retry) state.retry = 4; in init() 75 if (!(state.options & RES_INIT)) state.options = RES_DEFAULT; in init() 79 if (!state.id) state.id = res_randomid(); in init() 81 return __res_vinit(&state, 1); in init()
|