diff options
author | Stanley Cheung <stanleycheung@google.com> | 2016-05-03 15:50:07 -0700 |
---|---|---|
committer | Stanley Cheung <stanleycheung@google.com> | 2016-05-06 10:40:50 -0700 |
commit | 55643fee6b1c02277837b187d2ea706e86d9c315 (patch) | |
tree | dbfd285b550ee45b746a9a66adf7477a9e0f6260 /src/php/tests/interop/metrics_client.php | |
parent | acae9fe6e74eb0bb55c87a8046c1cdd6bf83f32a (diff) |
php: stress test client
Diffstat (limited to 'src/php/tests/interop/metrics_client.php')
-rw-r--r-- | src/php/tests/interop/metrics_client.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/php/tests/interop/metrics_client.php b/src/php/tests/interop/metrics_client.php new file mode 100644 index 0000000000..404e5e191b --- /dev/null +++ b/src/php/tests/interop/metrics_client.php @@ -0,0 +1,17 @@ +<?php + +$args = getopt('', ['metric_server_address:', 'total_only::']); +$parts = explode(':', $args['metric_server_address']); +$server_host = $parts[0]; +$server_port = (count($parts) == 2) ? $parts[1] : ''; + +$socket = socket_create(AF_INET, SOCK_STREAM, 0); +if (@!socket_connect($socket, $server_host, $server_port)) { + echo "Cannot connect to merics server...\n"; + exit(1); +} +socket_write($socket, 'qps'); +while ($out = socket_read($socket, 1024)) { + echo "$out\n"; +} +socket_close($socket); |