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

Unified Diff: third_party/grpc/test/core/iomgr/fd_conservation_posix_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
« no previous file with comments | « third_party/grpc/test/core/iomgr/endpoint_tests.c ('k') | third_party/grpc/test/core/iomgr/fd_posix_test.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/grpc/test/core/iomgr/fd_conservation_posix_test.c
diff --git a/third_party/tcmalloc/vendor/src/base/synchronization_profiling.h b/third_party/grpc/test/core/iomgr/fd_conservation_posix_test.c
similarity index 63%
copy from third_party/tcmalloc/vendor/src/base/synchronization_profiling.h
copy to third_party/grpc/test/core/iomgr/fd_conservation_posix_test.c
index cf02c218a111806189f71f7b528a83b5ceb164a4..401bf70a9e932fe3aaaa337eba20fac9fce46742 100644
--- a/third_party/tcmalloc/vendor/src/base/synchronization_profiling.h
+++ b/third_party/grpc/test/core/iomgr/fd_conservation_posix_test.c
@@ -1,4 +1,6 @@
-/* Copyright (c) 2010, Google Inc.
+/*
+ *
+ * Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -27,24 +29,38 @@
* (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: Chris Ruemmler
*/
-#ifndef BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_
-#define BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_
+#include <sys/resource.h>
+
+#include <grpc/support/log.h>
+
+#include "test/core/util/test_config.h"
+#include "src/core/iomgr/endpoint_pair.h"
+#include "src/core/iomgr/iomgr.h"
+
+int main(int argc, char **argv) {
+ int i;
+ struct rlimit rlim;
+ grpc_endpoint_pair p;
-#include "base/basictypes.h"
+ grpc_test_init(argc, argv);
+ grpc_iomgr_init();
-namespace base {
+ /* set max # of file descriptors to a low value, and
+ verify we can create and destroy many more than this number
+ of descriptors */
+ rlim.rlim_cur = rlim.rlim_max = 10;
+ GPR_ASSERT(0 == setrlimit(RLIMIT_NOFILE, &rlim));
-// We can do contention-profiling of SpinLocks, but the code is in
-// mutex.cc, which is not always linked in with spinlock. Hence we
-// provide a weak definition, which are used if mutex.cc isn't linked in.
+ for (i = 0; i < 100; i++) {
+ grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ p = grpc_iomgr_create_endpoint_pair("test", 1);
+ grpc_endpoint_destroy(&exec_ctx, p.client);
+ grpc_endpoint_destroy(&exec_ctx, p.server);
+ grpc_exec_ctx_finish(&exec_ctx);
+ }
-// Submit the number of cycles the spinlock spent contending.
-ATTRIBUTE_WEAK extern void SubmitSpinLockProfileData(const void *, int64);
-extern void SubmitSpinLockProfileData(const void *contendedlock,
- int64 wait_cycles) {}
+ grpc_iomgr_shutdown();
+ return 0;
}
-#endif // BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_
« no previous file with comments | « third_party/grpc/test/core/iomgr/endpoint_tests.c ('k') | third_party/grpc/test/core/iomgr/fd_posix_test.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698