• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2017 gRPC authors.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
16
17grpc_package(name = "test/core/memory_usage")
18
19licenses(["notice"])
20
21grpc_cc_library(
22    name = "memstats",
23    srcs = [
24        "memstats.cc",
25        "memstats.h",
26    ],
27    hdrs = ["memstats.h"],
28    external_deps = [
29        "absl/types:optional",
30    ],
31    tags = [
32        "bazel_only",
33        "no_mac",
34        "no_windows",
35    ],
36    deps = [
37        "//:gpr",
38    ],
39)
40
41grpc_cc_binary(
42    name = "memory_usage_client",
43    srcs = ["client.cc"],
44    external_deps = [
45        "absl/flags:flag",
46        "absl/flags:parse",
47    ],
48    tags = [
49        "bazel_only",
50        "no_mac",
51        "no_windows",
52    ],
53    deps = [
54        ":memstats",
55        "//:gpr",
56        "//:grpc",
57        "//src/core:channel_args",
58        "//test/core/util:grpc_test_util",
59        "//test/core/util:grpc_test_util_base",
60    ],
61)
62
63grpc_cc_binary(
64    name = "memory_usage_server",
65    srcs = ["server.cc"],
66    external_deps = [
67        "absl/flags:flag",
68        "absl/flags:parse",
69    ],
70    tags = [
71        "bazel_only",
72        "no_mac",
73        "no_windows",
74    ],
75    deps = [
76        ":memstats",
77        "//:gpr",
78        "//:grpc",
79        "//src/core:channel_args",
80        "//src/core:xds_enabled_server",
81        "//test/core/end2end:ssl_test_data",
82        "//test/core/util:grpc_test_util",
83        "//test/core/util:grpc_test_util_base",
84    ],
85)
86
87grpc_cc_binary(
88    name = "memory_usage_callback_client",
89    srcs = ["callback_client.cc"],
90    external_deps = [
91        "absl/flags:flag",
92        "absl/flags:parse",
93        "absl/time",
94    ],
95    tags = [
96        "bazel_only",
97        "no_mac",
98        "no_windows",
99    ],
100    deps = [
101        ":memstats",
102        "//:gpr",
103        "//:grpc",
104        "//:grpc++",
105        "//src/proto/grpc/testing:benchmark_service_proto",
106        "//test/core/end2end:ssl_test_data",
107        "//test/core/util:grpc_test_util",
108        "//test/core/util:grpc_test_util_base",
109    ],
110)
111
112grpc_cc_binary(
113    name = "memory_usage_callback_server",
114    srcs = ["callback_server.cc"],
115    external_deps = [
116        "absl/flags:flag",
117        "absl/flags:parse",
118    ],
119    tags = [
120        "bazel_only",
121        "no_mac",
122        "no_windows",
123    ],
124    deps = [
125        ":memstats",
126        "//:gpr",
127        "//:grpc",
128        "//:grpc++",
129        "//src/proto/grpc/testing:benchmark_service_proto",
130        "//test/core/end2end:ssl_test_data",
131        "//test/core/util:grpc_test_util",
132        "//test/core/util:grpc_test_util_base",
133    ],
134)
135
136MEMORY_USAGE_DATA = [
137    ":memory_usage_callback_client",
138    ":memory_usage_callback_server",
139    ":memory_usage_client",
140    ":memory_usage_server",
141]
142
143MEMORY_USAGE_TAGS = [
144    "bazel_only",
145    "no_mac",
146    "no_windows",
147]
148
149grpc_cc_test(
150    name = "memory_usage_test",
151    srcs = ["memory_usage_test.cc"],
152    data = MEMORY_USAGE_DATA,
153    external_deps = [
154        "absl/algorithm:container",
155        "absl/flags:flag",
156        "absl/flags:parse",
157    ],
158    language = "C++",
159    tags = MEMORY_USAGE_TAGS,
160    deps = [
161        "//:gpr",
162        "//:grpc",
163        "//:subprocess",
164        "//test/core/util:grpc_test_util",
165        "//test/core/util:grpc_test_util_base",
166        "//test/cpp/end2end/xds:xds_utils",
167    ],
168)
169
170grpc_cc_binary(
171    name = "memory_usage",
172    srcs = ["memory_usage_test.cc"],
173    data = MEMORY_USAGE_DATA,
174    external_deps = [
175        "absl/algorithm:container",
176        "absl/flags:flag",
177        "absl/flags:parse",
178    ],
179    language = "C++",
180    tags = MEMORY_USAGE_TAGS,
181    deps = [
182        "//:gpr",
183        "//:grpc",
184        "//:subprocess",
185        "//test/core/util:grpc_test_util",
186        "//test/core/util:grpc_test_util_base",
187        "//test/cpp/end2end/xds:xds_utils",
188    ],
189)
190