MCPcopy Create free account
hub / github.com/facebook/time / fbclock_clockdata_load_data

Function fbclock_clockdata_load_data

fbclock/fbclock.c:173–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171 fbclock_section_store(&shmp->realtime, data);
172 munmap(shmp, FBCLOCK_SHMDATA_V2_SIZE);
173 return FBCLOCK_E_NO_ERROR;
174}
175
176int fbclock_clockdata_load_data(
177 fbclock_shmdata* shmp,
178 fbclock_clockdata* data) {
179 for (int i = 0; i < FBCLOCK_MAX_READ_TRIES; i++) {
180 memcpy(data, &shmp->data, FBCLOCK_CLOCKDATA_SIZE);
181 uint64_t crc = atomic_load(&shmp->crc);
182 uint64_t our_crc = fbclock_clockdata_crc(data);
183 if (our_crc == crc) {
184 fbclock_debug_print("reading clock data took %d tries\n", i + 1);
185 return FBCLOCK_E_NO_ERROR;
186 }
187 }
188 fbclock_debug_print(
189 "failed to read clock data after %d tries\n", FBCLOCK_MAX_READ_TRIES);
190 // TODO: Enable mismatch error.
191 // return FBCLOCK_E_CRC_MISMATCH;
192 return FBCLOCK_E_NO_ERROR;
193}

Callers 3

fbclock_gettime_tzFunction · 0.85
TESTFunction · 0.85
reader_threadFunction · 0.85

Calls 1

fbclock_clockdata_crcFunction · 0.85

Tested by 2

TESTFunction · 0.68
reader_threadFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…