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

Unified Diff: third_party/grpc/test/core/util/test_config.h

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
« no previous file with comments | « third_party/grpc/test/core/util/slice_splitter.c ('k') | third_party/grpc/test/core/util/test_config.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/grpc/test/core/util/test_config.h
diff --git a/third_party/tcmalloc/vendor/src/base/thread_lister.c b/third_party/grpc/test/core/util/test_config.h
similarity index 50%
copy from third_party/tcmalloc/vendor/src/base/thread_lister.c
copy to third_party/grpc/test/core/util/test_config.h
index bc180dba7a9f2ba3b8261009c8af85f0b1d4a023..f6bb2e1f72a2317bca2acf0e18cbff00d04f4609 100644
--- a/third_party/tcmalloc/vendor/src/base/thread_lister.c
+++ b/third_party/grpc/test/core/util/test_config.h
@@ -1,4 +1,6 @@
-/* Copyright (c) 2005-2007, Google Inc.
+/*
+ *
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -27,51 +29,51 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * ---
- * Author: Markus Gutschke
*/
-#include "config.h"
-#include <stdio.h> /* needed for NULL on some powerpc platforms (?!) */
-#ifdef HAVE_SYS_PRCTL
-# include <sys/prctl.h>
-#endif
-#include "base/thread_lister.h"
-#include "base/linuxthreads.h"
-/* Include other thread listers here that define THREADS macro
- * only when they can provide a good implementation.
- */
+#ifndef GRPC_TEST_CORE_UTIL_TEST_CONFIG_H
+#define GRPC_TEST_CORE_UTIL_TEST_CONFIG_H
-#ifndef THREADS
+#include <grpc/support/time.h>
-/* Default trivial thread lister for single-threaded applications,
- * or if the multi-threading code has not been ported, yet.
- */
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
-int ListAllProcessThreads(void *parameter,
- ListAllProcessThreadsCallBack callback, ...) {
- int rc;
- va_list ap;
- pid_t pid;
+#ifndef GRPC_TEST_SLOWDOWN_BUILD_FACTOR
+#define GRPC_TEST_SLOWDOWN_BUILD_FACTOR 1.0
+#endif
-#ifdef HAVE_SYS_PRCTL
- int dumpable = prctl(PR_GET_DUMPABLE, 0);
- if (!dumpable)
- prctl(PR_SET_DUMPABLE, 1);
+#ifndef GRPC_TEST_SLOWDOWN_MACHINE_FACTOR
+#define GRPC_TEST_SLOWDOWN_MACHINE_FACTOR 1.0
#endif
- va_start(ap, callback);
- pid = getpid();
- rc = callback(parameter, 1, &pid, ap);
- va_end(ap);
-#ifdef HAVE_SYS_PRCTL
- if (!dumpable)
- prctl(PR_SET_DUMPABLE, 0);
+
+extern double g_fixture_slowdown_factor;
+
+#define GRPC_TEST_SLOWDOWN_FACTOR \
+ (GRPC_TEST_SLOWDOWN_BUILD_FACTOR * GRPC_TEST_SLOWDOWN_MACHINE_FACTOR * \
+ g_fixture_slowdown_factor)
+
+#define GRPC_TIMEOUT_SECONDS_TO_DEADLINE(x) \
+ gpr_time_add( \
+ gpr_now(GPR_CLOCK_MONOTONIC), \
+ gpr_time_from_millis((int64_t)(GRPC_TEST_SLOWDOWN_FACTOR * 1e3 * (x)), \
+ GPR_TIMESPAN))
+
+#define GRPC_TIMEOUT_MILLIS_TO_DEADLINE(x) \
+ gpr_time_add( \
+ gpr_now(GPR_CLOCK_MONOTONIC), \
+ gpr_time_from_micros((int64_t)(GRPC_TEST_SLOWDOWN_FACTOR * 1e3 * (x)), \
+ GPR_TIMESPAN))
+
+#ifndef GRPC_TEST_CUSTOM_PICK_PORT
+#define GRPC_TEST_PICK_PORT
#endif
- return rc;
-}
-int ResumeAllProcessThreads(int num_threads, pid_t *thread_pids) {
- return 1;
+void grpc_test_init(int argc, char **argv);
+
+#ifdef __cplusplus
}
+#endif /* __cplusplus */
-#endif /* ifndef THREADS */
+#endif /* GRPC_TEST_CORE_UTIL_TEST_CONFIG_H */
« no previous file with comments | « third_party/grpc/test/core/util/slice_splitter.c ('k') | third_party/grpc/test/core/util/test_config.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698