MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / prof_dump_write

Function prof_dump_write

deps/memkind/src/jemalloc/src/prof.c:1009–1038  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1007}
1008
1009static bool
1010prof_dump_write(bool propagate_err, const char *s) {
1011 size_t i, slen, n;
1012
1013 cassert(config_prof);
1014
1015 i = 0;
1016 slen = strlen(s);
1017 while (i < slen) {
1018 /* Flush the buffer if it is full. */
1019 if (prof_dump_buf_end == PROF_DUMP_BUFSIZE) {
1020 if (prof_dump_flush(propagate_err) && propagate_err) {
1021 return true;
1022 }
1023 }
1024
1025 if (prof_dump_buf_end + slen <= PROF_DUMP_BUFSIZE) {
1026 /* Finish writing. */
1027 n = slen - i;
1028 } else {
1029 /* Write as much of s as will fit. */
1030 n = PROF_DUMP_BUFSIZE - prof_dump_buf_end;
1031 }
1032 memcpy(&prof_dump_buf[prof_dump_buf_end], &s[i], n);
1033 prof_dump_buf_end += n;
1034 i += n;
1035 }
1036
1037 return false;
1038}
1039
1040JEMALLOC_FORMAT_PRINTF(2, 3)
1041static bool

Callers 2

prof_dump_printfFunction · 0.70
prof_dump_mapsFunction · 0.70

Calls 1

prof_dump_flushFunction · 0.70

Tested by

no test coverage detected