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 */ |