Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(715)

Unified Diff: third_party/grpc/test/core/statistics/census_stub_test.c

Issue 1932353002: Initial checkin of gRPC to third_party/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/grpc/test/core/statistics/census_stub_test.c
diff --git a/third_party/WebKit/Source/build/win/Precompile.h b/third_party/grpc/test/core/statistics/census_stub_test.c
similarity index 50%
copy from third_party/WebKit/Source/build/win/Precompile.h
copy to third_party/grpc/test/core/statistics/census_stub_test.c
index 8a0ff29c353fc1d30c92d27f369d7c422a579bc8..8e409a37263caf32b5d5a938459e7691b72110fe 100644
--- a/third_party/WebKit/Source/build/win/Precompile.h
+++ b/third_party/grpc/test/core/statistics/census_stub_test.c
@@ -1,5 +1,7 @@
/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -26,43 +28,50 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Precompiled header for WebKit when built on Windows using
- * GYP-generated project files. Not used by other build
- * configurations.
*
- * Using precompiled headers speeds the build up significantly. On a
- * fast machine (HP Z600, 12 GB of RAM), an ~18% decrease in full
- * build time was measured.
*/
-#if defined(WinPrecompile_h_)
-#error You shouldn't include the precompiled header file more than once.
-#endif
-
-#define WinPrecompile_h_
+#include <stdio.h>
+#include <stdlib.h>
-#define _USE_MATH_DEFINES // Make math.h behave like other platforms.
+#include "src/core/statistics/census_interface.h"
+#include "src/core/statistics/census_rpc_stats.h"
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
+#include "test/core/util/test_config.h"
-#include <Windows.h>
+/* Tests census noop stubs in a simulated rpc flow */
+void test_census_stubs(void) {
+ census_op_id op_id;
+ census_rpc_stats *stats = census_rpc_stats_create_empty();
+ census_aggregated_rpc_stats data_map = {0, NULL};
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <math.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
+ /* Initializes census library at server start up time. */
+ census_init();
+ /* Starts tracing at the beginning of a rpc. */
+ op_id = census_tracing_start_op();
+ /* Appends custom annotations on a trace object. */
+ census_tracing_print(op_id, "annotation foo");
+ census_tracing_print(op_id, "annotation bar");
+ /* Appends method tag on the trace object. */
+ census_add_method_tag(op_id, "service_foo/method.bar");
+ /* Either record client side stats or server side stats associated with the
+ op_id. Here for testing purpose, we record both. */
+ census_record_rpc_client_stats(op_id, stats);
+ census_record_rpc_server_stats(op_id, stats);
+ /* Ends a tracing. */
+ census_tracing_end_op(op_id);
+ /* In process stats queries. */
+ census_get_server_stats(&data_map);
+ census_aggregated_rpc_stats_set_empty(&data_map);
+ census_get_client_stats(&data_map);
+ census_aggregated_rpc_stats_set_empty(&data_map);
+ gpr_free(stats);
+ census_shutdown();
+}
-#include <algorithm>
-#include <ciso646>
-#include <cmath>
-#include <cstddef>
-#include <limits>
-#include <string>
-#include <utility>
+int main(int argc, char **argv) {
+ grpc_test_init(argc, argv);
+ test_census_stubs();
+ return 0;
+}
« no previous file with comments | « third_party/grpc/test/core/statistics/census_log_tests.c ('k') | third_party/grpc/test/core/statistics/hash_table_test.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698