aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/memory_usage
diff options
context:
space:
mode:
authorGravatar Noah Eisen <ncteisen@google.com>2018-02-09 09:16:55 -0800
committerGravatar Noah Eisen <ncteisen@google.com>2018-02-09 09:16:55 -0800
commitbe82e64b3debcdb1d9ec6a149fc85af0d46bfb7e (patch)
treecc5e1234073eb250a2c319b5a4db2919fce060ea /test/core/memory_usage
parent194436342137924b4fb7429bede037a4b5ec7edb (diff)
Autofix c casts to c++ casts
Diffstat (limited to 'test/core/memory_usage')
-rw-r--r--test/core/memory_usage/client.cc16
-rw-r--r--test/core/memory_usage/memory_usage_test.cc2
-rw-r--r--test/core/memory_usage/server.cc12
3 files changed, 15 insertions, 15 deletions
diff --git a/test/core/memory_usage/client.cc b/test/core/memory_usage/client.cc
index 4f2ca9e937..96ff7ca721 100644
--- a/test/core/memory_usage/client.cc
+++ b/test/core/memory_usage/client.cc
@@ -155,16 +155,16 @@ static struct grpc_memory_counters send_snapshot_request(int call_idx,
struct grpc_memory_counters snapshot;
snapshot.total_size_absolute =
- ((struct grpc_memory_counters*)GRPC_SLICE_START_PTR(response))
+ (reinterpret_cast<struct grpc_memory_counters*>GRPC_SLICE_START_PTR(response))
->total_size_absolute;
snapshot.total_allocs_absolute =
- ((struct grpc_memory_counters*)GRPC_SLICE_START_PTR(response))
+ (reinterpret_cast<struct grpc_memory_counters*>GRPC_SLICE_START_PTR(response))
->total_allocs_absolute;
snapshot.total_size_relative =
- ((struct grpc_memory_counters*)GRPC_SLICE_START_PTR(response))
+ (reinterpret_cast<struct grpc_memory_counters*>GRPC_SLICE_START_PTR(response))
->total_size_relative;
snapshot.total_allocs_relative =
- ((struct grpc_memory_counters*)GRPC_SLICE_START_PTR(response))
+ (reinterpret_cast<struct grpc_memory_counters*>GRPC_SLICE_START_PTR(response))
->total_allocs_relative;
grpc_metadata_array_destroy(&calls[call_idx].initial_metadata_recv);
@@ -285,7 +285,7 @@ int main(int argc, char** argv) {
gpr_log(GPR_INFO, "---------client stats--------");
gpr_log(GPR_INFO, "client call memory usage: %f bytes per call",
- (double)(client_calls_inflight.total_size_relative -
+ static_cast<double>(client_calls_inflight.total_size_relative -
client_benchmark_calls_start.total_size_relative) /
benchmark_iterations);
gpr_log(GPR_INFO, "client channel memory usage %zi bytes",
@@ -297,7 +297,7 @@ int main(int argc, char** argv) {
after_server_create.total_size_relative -
before_server_create.total_size_relative);
gpr_log(GPR_INFO, "server call memory usage: %f bytes per call",
- (double)(server_calls_inflight.total_size_relative -
+ static_cast<double>(server_calls_inflight.total_size_relative -
server_benchmark_calls_start.total_size_relative) /
benchmark_iterations);
gpr_log(GPR_INFO, "server channel memory usage %zi bytes",
@@ -310,14 +310,14 @@ int main(int argc, char** argv) {
char* env_build = gpr_getenv("BUILD_NUMBER");
char* env_job = gpr_getenv("JOB_NAME");
fprintf(csv, "%f,%zi,%zi,%f,%zi,%s,%s\n",
- (double)(client_calls_inflight.total_size_relative -
+ static_cast<double>(client_calls_inflight.total_size_relative -
client_benchmark_calls_start.total_size_relative) /
benchmark_iterations,
client_channel_end.total_size_relative -
client_channel_start.total_size_relative,
after_server_create.total_size_relative -
before_server_create.total_size_relative,
- (double)(server_calls_inflight.total_size_relative -
+ static_cast<double>(server_calls_inflight.total_size_relative -
server_benchmark_calls_start.total_size_relative) /
benchmark_iterations,
server_calls_end.total_size_relative -
diff --git a/test/core/memory_usage/memory_usage_test.cc b/test/core/memory_usage/memory_usage_test.cc
index cc3528b060..c170f5ad26 100644
--- a/test/core/memory_usage/memory_usage_test.cc
+++ b/test/core/memory_usage/memory_usage_test.cc
@@ -37,7 +37,7 @@ int main(int argc, char** argv) {
gpr_subprocess *svr, *cli;
/* figure out where we are */
if (lslash) {
- memcpy(root, me, (size_t)(lslash - me));
+ memcpy(root, me, static_cast<size_t>(lslash - me));
root[lslash - me] = 0;
} else {
strcpy(root, ".");
diff --git a/test/core/memory_usage/server.cc b/test/core/memory_usage/server.cc
index a276102e83..f016fb248d 100644
--- a/test/core/memory_usage/server.cc
+++ b/test/core/memory_usage/server.cc
@@ -73,7 +73,7 @@ typedef struct {
static fling_call calls[100006];
static void request_call_unary(int call_idx) {
- if (call_idx == (int)(sizeof(calls) / sizeof(fling_call))) {
+ if (call_idx == static_cast<int>(sizeof(calls) / sizeof(fling_call))) {
gpr_log(GPR_INFO, "Used all call slots (10000) on server. Server exit.");
_exit(0);
}
@@ -84,7 +84,7 @@ static void request_call_unary(int call_idx) {
}
static void send_initial_metadata_unary(void* tag) {
- grpc_metadata_array_init(&(*(fling_call*)tag).initial_metadata_send);
+ grpc_metadata_array_init(&(*static_cast<fling_call*>(tag)).initial_metadata_send);
metadata_ops[0].op = GRPC_OP_SEND_INITIAL_METADATA;
metadata_ops[0].data.send_initial_metadata.count = 0;
@@ -111,7 +111,7 @@ static void send_snapshot(void* tag, struct grpc_memory_counters* snapshot) {
grpc_slice snapshot_slice =
grpc_slice_new(snapshot, sizeof(*snapshot), gpr_free);
payload_buffer = grpc_raw_byte_buffer_create(&snapshot_slice, 1);
- grpc_metadata_array_init(&(*(fling_call*)tag).initial_metadata_send);
+ grpc_metadata_array_init(&(*static_cast<fling_call*>(tag)).initial_metadata_send);
op = snapshot_ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
@@ -163,7 +163,7 @@ int main(int argc, char** argv) {
grpc_test_init(1, fake_argv);
grpc_init();
- srand((unsigned)clock());
+ srand(static_cast<unsigned>(clock()));
cl = gpr_cmdline_create("fling server");
gpr_cmdline_add_string(cl, "bind", "Bind host:port", &addr);
@@ -204,7 +204,7 @@ int main(int argc, char** argv) {
addr = addr_buf = nullptr;
// initialize call instances
- for (int i = 0; i < (int)(sizeof(calls) / sizeof(fling_call)); i++) {
+ for (int i = 0; i < static_cast<int>(sizeof(calls) / sizeof(fling_call)); i++) {
grpc_call_details_init(&calls[i].call_details);
calls[i].state = FLING_SERVER_NEW_REQUEST;
}
@@ -281,7 +281,7 @@ int main(int argc, char** argv) {
grpc_metadata_array_destroy(&s->request_metadata_recv);
break;
case FLING_SERVER_BATCH_SEND_STATUS_FLING_CALL:
- for (int k = 0; k < (int)(sizeof(calls) / sizeof(fling_call));
+ for (int k = 0; k < static_cast<int>(sizeof(calls) / sizeof(fling_call));
++k) {
if (calls[k].state == FLING_SERVER_WAIT_FOR_DESTROY) {
calls[k].state = FLING_SERVER_SEND_STATUS_FLING_CALL;