Go to the documentation of this file.
24 #include "absl/strings/str_format.h"
25 #include "absl/strings/str_join.h"
46 static void test(
const char*
name,
size_t init_size,
const size_t* allocs,
48 std::vector<std::string> parts;
51 for (
size_t i = 0;
i < nallocs;
i++) {
59 void** ps =
static_cast<void**
>(
gpr_zalloc(
sizeof(*ps) * nallocs));
60 for (
size_t i = 0;
i < nallocs;
i++) {
61 ps[
i] =
a->Alloc(allocs[
i]);
65 for (
size_t j = 0; j <
i; j++) {
75 #define TEST(name, init_size, ...) \
76 static const size_t allocs_##name[] = {__VA_ARGS__}; \
77 test(#name, init_size, allocs_##name, GPR_ARRAY_SIZE(allocs_##name))
79 #define CONCURRENT_TEST_THREADS 10
82 if (
sizeof(
void*) < 8)
return 1000;
95 *
static_cast<char*
>(
a->arena->Alloc(1)) =
static_cast<char>(
i);
116 for (
auto& th : thds) {
120 args.arena->Destroy();
123 int main(
int argc,
char* argv[]) {
131 TEST(1_inc, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
132 TEST(6_123, 6, 1, 2, 3);
return memset(p, 0, total)
ABSL_MUST_USE_RESULT std::string StrFormat(const FormatSpec< Args... > &format, const Args &... args)
GPRAPI void gpr_event_set(gpr_event *ev, void *value)
GPRAPI void gpr_free(void *ptr)
GPRAPI gpr_timespec gpr_inf_future(gpr_clock_type type)
static void test(const char *name, size_t init_size, const size_t *allocs, size_t nallocs)
static auto * g_memory_allocator
GPRAPI void * gpr_zalloc(size_t size)
std::string StrJoin(Iterator start, Iterator end, absl::string_view sep, Formatter &&fmt)
#define TEST(name, init_size,...)
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
static ResourceQuotaRefPtr Default()
GPRAPI void gpr_event_init(gpr_event *ev)
GPRAPI void * gpr_event_wait(gpr_event *ev, gpr_timespec abs_deadline)
static void concurrent_test(void)
size_t concurrent_test_iterations()
static void test_noop(void)
int main(int argc, char *argv[])
static void concurrent_test_body(void *arg)
#define CONCURRENT_TEST_THREADS
grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:42