Cleanup
This commit is contained in:
parent
0f5ee37933
commit
c4869be014
20
README.md
20
README.md
|
@ -1,10 +1,10 @@
|
|||
# jPerf
|
||||
|
||||
Small utility to measure network performance.
|
||||
Small utility to measure network performance between two hosts.
|
||||
|
||||
## Requirements
|
||||
|
||||
You need Java (JRE) version 11 or later to run jperf.
|
||||
You need Java (JRE) version 8 or later to run jperf.
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
|
@ -12,20 +12,26 @@ You need Java (JRE) version 11 or later to run jperf.
|
|||
- Run **/opt/jperf/bin/jperf**, if installed from package
|
||||
- Or as **java -jar /path/to/jperf.jar**
|
||||
|
||||
To change the temporary directory where disk-load files are written to, use the *-Djava.io.tmpdir=/mytempdir* option.
|
||||
|
||||
```shell
|
||||
Usage: ...
|
||||
Usage: jperf [-hV] [-l=SIZE] [-n=NUM] [-p=PORT] (-c=HOST | -s)
|
||||
Network performance measurement tool.
|
||||
-c, --connect=HOST Connect to remote server
|
||||
-h, --help Show this help message and exit.
|
||||
-l, --pkt-len=SIZE Datagram size in bytes, max 65507 [default: 65507]
|
||||
-n, --pkt-num=NUM Number of packets to send [default: 150000]
|
||||
-p, --port=PORT Network port [default: 4445]
|
||||
-s, --server Run server and wait for client
|
||||
-V, --version Print version information and exit.
|
||||
```
|
||||
|
||||
## Development Information
|
||||
|
||||
You need Java (JDK) version 11 or later to build jperf.
|
||||
You need Java (JDK) version 8 or later to build jperf.
|
||||
|
||||
### Build & Test
|
||||
|
||||
Use the gradle build tool, which will download all required dependencies:
|
||||
|
||||
```shell
|
||||
./gradlew clean build run
|
||||
./gradlew clean build
|
||||
```
|
||||
|
|
|
@ -22,7 +22,6 @@ dependencies {
|
|||
implementation 'ch.qos.logback:logback-classic:1.3.8'
|
||||
}
|
||||
|
||||
// Apply a specific Java toolchain to ease working on different environments.
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(8)
|
||||
|
@ -33,12 +32,10 @@ java {
|
|||
|
||||
|
||||
application {
|
||||
// Define the main class for the application.
|
||||
mainClass = 'biz.nellemann.jperf.Application'
|
||||
}
|
||||
|
||||
tasks.named('test') {
|
||||
// Use JUnit Platform for unit tests.
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,5 @@
|
|||
/*
|
||||
* This file was generated by the Gradle 'init' task.
|
||||
*
|
||||
* The settings file is used to specify which projects to include in your build.
|
||||
*
|
||||
* Detailed information about configuring a multi-project build in Gradle can be found
|
||||
* in the user manual at https://docs.gradle.org/8.1.1/userguide/multi_project_builds.html
|
||||
*/
|
||||
|
||||
plugins {
|
||||
// Apply the foojay-resolver plugin to allow automatic download of JDKs
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0'
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
|
||||
}
|
||||
|
||||
rootProject.name = 'jperf'
|
||||
|
|
|
@ -1,5 +1,17 @@
|
|||
/*
|
||||
* This Java source file was generated by the Gradle 'init' task.
|
||||
Copyright 2023 mark.nellemann@gmail.com
|
||||
|
||||
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 biz.nellemann.jperf;
|
||||
|
||||
|
@ -13,8 +25,7 @@ import java.io.IOException;
|
|||
import java.net.SocketException;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
@Command(name = "jperf", mixinStandardHelpOptions = true, version = "0.1",
|
||||
description = "Network performance measurement tool.")
|
||||
@Command(name = "jperf", mixinStandardHelpOptions = true, versionProvider = VersionProvider.class, description = "Network performance measurement tool.")
|
||||
public class Application implements Callable<Integer> {
|
||||
|
||||
final Logger log = LoggerFactory.getLogger(Application.class);
|
||||
|
@ -43,7 +54,7 @@ public class Application implements Callable<Integer> {
|
|||
|
||||
|
||||
@Override
|
||||
public Integer call() throws Exception { // your business logic goes here...
|
||||
public Integer call() throws Exception {
|
||||
|
||||
if(runMode.runServer) {
|
||||
runServer();
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
/*
|
||||
Copyright 2023 mark.nellemann@gmail.com
|
||||
|
||||
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 biz.nellemann.jperf;
|
||||
|
||||
public enum DataType {
|
||||
|
|
|
@ -1,10 +1,24 @@
|
|||
/*
|
||||
Copyright 2023 mark.nellemann@gmail.com
|
||||
|
||||
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 biz.nellemann.jperf;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
/*
|
||||
Copyright 2023 mark.nellemann@gmail.com
|
||||
|
||||
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 biz.nellemann.jperf;
|
||||
|
||||
import java.time.Duration;
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
/*
|
||||
Copyright 2023 mark.nellemann@gmail.com
|
||||
|
||||
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 biz.nellemann.jperf;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -6,7 +21,6 @@ import java.net.DatagramSocket;
|
|||
import java.net.InetAddress;
|
||||
import java.net.SocketException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.time.Instant;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
/*
|
||||
Copyright 2023 mark.nellemann@gmail.com
|
||||
|
||||
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 biz.nellemann.jperf;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
34
src/main/java/biz/nellemann/jperf/VersionProvider.java
Normal file
34
src/main/java/biz/nellemann/jperf/VersionProvider.java
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
Copyright 2023 mark.nellemann@gmail.com
|
||||
|
||||
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 biz.nellemann.jperf;
|
||||
|
||||
import picocli.CommandLine;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
class VersionProvider implements CommandLine.IVersionProvider {
|
||||
|
||||
public String[] getVersion() throws IOException {
|
||||
|
||||
Manifest manifest = new Manifest(getClass().getResourceAsStream("/META-INF/MANIFEST.MF"));
|
||||
Attributes attrs = manifest.getMainAttributes();
|
||||
|
||||
return new String[] { "${COMMAND-FULL-NAME} " + attrs.getValue("Build-Version") };
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue