Skip to content

Commit 610e587

Browse files
committed
Merge branch 'master' into security-app-privs
2 parents 02bfc8d + edbea73 commit 610e587

File tree

277 files changed

+9962
-2004
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

277 files changed

+9962
-2004
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
/*
2+
* Licensed to Elasticsearch under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.elasticsearch.benchmark.indices.breaker;
20+
21+
import org.openjdk.jmh.annotations.Benchmark;
22+
import org.openjdk.jmh.annotations.BenchmarkMode;
23+
import org.openjdk.jmh.annotations.Fork;
24+
import org.openjdk.jmh.annotations.Measurement;
25+
import org.openjdk.jmh.annotations.Mode;
26+
import org.openjdk.jmh.annotations.OutputTimeUnit;
27+
import org.openjdk.jmh.annotations.Param;
28+
import org.openjdk.jmh.annotations.Scope;
29+
import org.openjdk.jmh.annotations.State;
30+
import org.openjdk.jmh.annotations.Threads;
31+
import org.openjdk.jmh.annotations.Warmup;
32+
import org.openjdk.jmh.infra.Blackhole;
33+
34+
import java.lang.management.ManagementFactory;
35+
import java.lang.management.MemoryMXBean;
36+
import java.util.concurrent.TimeUnit;
37+
38+
@Fork(3)
39+
@Warmup(iterations = 10)
40+
@Measurement(iterations = 10)
41+
@BenchmarkMode(Mode.AverageTime)
42+
@OutputTimeUnit(TimeUnit.MICROSECONDS)
43+
@State(Scope.Benchmark)
44+
@SuppressWarnings("unused") //invoked by benchmarking framework
45+
public class MemoryStatsBenchmark {
46+
private static final MemoryMXBean MEMORY_MX_BEAN = ManagementFactory.getMemoryMXBean();
47+
48+
@Param({"0", "16", "256", "4096"})
49+
private int tokens;
50+
51+
@Benchmark
52+
public void baseline() {
53+
Blackhole.consumeCPU(tokens);
54+
}
55+
56+
@Benchmark
57+
@Threads(1)
58+
public long getMemoryStats_01() {
59+
Blackhole.consumeCPU(tokens);
60+
return MEMORY_MX_BEAN.getHeapMemoryUsage().getUsed();
61+
}
62+
63+
@Benchmark
64+
@Threads(2)
65+
public long getMemoryStats_02() {
66+
Blackhole.consumeCPU(tokens);
67+
return MEMORY_MX_BEAN.getHeapMemoryUsage().getUsed();
68+
}
69+
70+
@Benchmark
71+
@Threads(4)
72+
public long getMemoryStats_04() {
73+
Blackhole.consumeCPU(tokens);
74+
return MEMORY_MX_BEAN.getHeapMemoryUsage().getUsed();
75+
}
76+
77+
@Benchmark
78+
@Threads(8)
79+
public long getMemoryStats_08() {
80+
Blackhole.consumeCPU(tokens);
81+
return MEMORY_MX_BEAN.getHeapMemoryUsage().getUsed();
82+
}
83+
84+
@Benchmark
85+
@Threads(16)
86+
public long getMemoryStats_16() {
87+
Blackhole.consumeCPU(tokens);
88+
return MEMORY_MX_BEAN.getHeapMemoryUsage().getUsed();
89+
}
90+
91+
@Benchmark
92+
@Threads(32)
93+
public long getMemoryStats_32() {
94+
Blackhole.consumeCPU(tokens);
95+
return MEMORY_MX_BEAN.getHeapMemoryUsage().getUsed();
96+
}
97+
98+
@Benchmark
99+
@Threads(64)
100+
public long getMemoryStats_64() {
101+
Blackhole.consumeCPU(tokens);
102+
return MEMORY_MX_BEAN.getHeapMemoryUsage().getUsed();
103+
}
104+
}
105+

build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,9 @@ allprojects {
435435
if (isEclipse) {
436436
// set this so generated dirs will be relative to eclipse build
437437
project.buildDir = eclipseBuild
438+
// Work around https://docs.gradle.org/current/userguide/java_gradle_plugin.html confusing Eclipse by the metadata
439+
// it adds to the classpath
440+
project.file("$buildDir/pluginUnderTestMetadata").mkdirs()
438441
}
439442
eclipse.classpath.file.whenMerged { classpath ->
440443
// give each source folder a unique corresponding output folder

buildSrc/build.gradle

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ if (project == rootProject) {
128128
}
129129
mavenCentral()
130130
}
131+
test {
132+
include "**/*Tests.class"
133+
exclude "**/*IT.class"
134+
}
131135
}
132136

133137
/*****************************************************************************
@@ -152,6 +156,18 @@ if (project != rootProject) {
152156
jarHell.enabled = false
153157
thirdPartyAudit.enabled = false
154158

159+
// tests can't be run with randomized test runner
160+
// it's fine as we run them as part of :buildSrc
161+
test.enabled = false
162+
task integTest(type: Test) {
163+
exclude "**/*Tests.class"
164+
include "**/*IT.class"
165+
testClassesDirs = sourceSets.test.output.classesDirs
166+
classpath = sourceSets.test.runtimeClasspath
167+
inputs.dir(file("src/testKit"))
168+
}
169+
check.dependsOn(integTest)
170+
155171
// TODO: re-enable once randomizedtesting gradle code is published and removed from here
156172
licenseHeaders.enabled = false
157173

buildSrc/src/main/groovy/org/elasticsearch/gradle/LoggedExec.java

Lines changed: 0 additions & 41 deletions
This file was deleted.

buildSrc/src/main/groovy/org/elasticsearch/gradle/Version.groovy

Lines changed: 0 additions & 147 deletions
This file was deleted.

buildSrc/src/main/groovy/org/elasticsearch/gradle/vagrant/VagrantTestPlugin.groovy

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,11 @@ class VagrantTestPlugin implements Plugin<Project> {
526526
project.gradle.removeListener(batsPackagingReproListener)
527527
}
528528
if (project.extensions.esvagrant.boxes.contains(box)) {
529-
packagingTest.dependsOn(batsPackagingTest)
529+
// these tests are temporarily disabled for suse boxes while we debug an issue
530+
// https://github.com/elastic/elasticsearch/issues/30295
531+
if (box.equals("opensuse-42") == false && box.equals("sles-12") == false) {
532+
packagingTest.dependsOn(batsPackagingTest)
533+
}
530534
}
531535
}
532536

@@ -565,7 +569,11 @@ class VagrantTestPlugin implements Plugin<Project> {
565569
project.gradle.removeListener(javaPackagingReproListener)
566570
}
567571
if (project.extensions.esvagrant.boxes.contains(box)) {
568-
packagingTest.dependsOn(javaPackagingTest)
572+
// these tests are temporarily disabled for suse boxes while we debug an issue
573+
// https://github.com/elastic/elasticsearch/issues/30295
574+
if (box.equals("opensuse-42") == false && box.equals("sles-12") == false) {
575+
packagingTest.dependsOn(javaPackagingTest)
576+
}
569577
}
570578

571579
/*

0 commit comments

Comments
 (0)