-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change the WorkerSpec that's sent to workers to an abstract class (Wo…
…rkerRequest) with three subtypes: - TrialRequest: what WorkerSpec previously was; a request for running a single trial - BenchmarkInfoRequest: a request for the info on a benchmark class (methods, parameters, etc.) - DryRunRequest: a request for the worker to do a dry run of the benchmark Handling for BenchmarkInfoRequest and DryRunRequest is NYI. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=163854733
- Loading branch information
1 parent
88b253a
commit 24ce9b2
Showing
11 changed files
with
227 additions
and
74 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
caliper-core/src/main/java/com/google/caliper/bridge/BenchmarkInfoRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (C) 2017 Google Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.google.caliper.bridge; | ||
|
||
import static com.google.common.base.Preconditions.checkArgument; | ||
|
||
/** | ||
* {@link WorkerRequest} for telling a worker to send the runner the information it needs on the | ||
* benchmark, such as what methods and parameters it has. | ||
* | ||
* @author Colin Decker | ||
*/ | ||
public final class BenchmarkInfoRequest extends WorkerRequest { | ||
private static final long serialVersionUID = 1L; | ||
|
||
private final String benchmarkClass; | ||
|
||
public BenchmarkInfoRequest(String benchmarkClass, int port) { | ||
super(port); | ||
checkArgument(!benchmarkClass.isEmpty()); | ||
this.benchmarkClass = benchmarkClass; | ||
} | ||
|
||
/** | ||
* Returns the name of the benchmark class to get info for. | ||
*/ | ||
public String benchmarkClass() { | ||
return benchmarkClass; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
caliper-core/src/main/java/com/google/caliper/bridge/DryRunRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (C) 2017 Google Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.google.caliper.bridge; | ||
|
||
/** | ||
* {@link WorkerRequest} for telling a worker to do a dry-run of a benchmark. | ||
* | ||
* @author Colin Decker | ||
*/ | ||
public final class DryRunRequest extends WorkerRequest { | ||
private static final long serialVersionUID = 1L; | ||
|
||
public DryRunRequest(int port) { | ||
super(port); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
caliper-core/src/main/java/com/google/caliper/bridge/WorkerRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (C) 2011 Google Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.google.caliper.bridge; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* Base class for classes the runner sends to the worker to tell it what to do. | ||
* | ||
* @author Colin Decker | ||
*/ | ||
public abstract class WorkerRequest implements Serializable { | ||
|
||
private final int port; | ||
|
||
protected WorkerRequest(int port) { | ||
this.port = port; | ||
} | ||
|
||
/** | ||
* Returns the port the worker should open a socket connection to for communication. | ||
*/ | ||
public int port() { | ||
return port; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.