Skip to content

Commit

Permalink
Try #112:
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] authored Feb 3, 2021
2 parents f08b61d + ed114a5 commit 91528f5
Show file tree
Hide file tree
Showing 18 changed files with 151 additions and 20 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ jobs:
- name: Building release version
run:
cargo build -p rusty_demo -Z build-std=std,core,alloc,panic_abort --target x86_64-unknown-hermit --release
- name: Building release version (LTO)
run:
cargo build -p rusty_demo --profile release-lto -Z unstable-options -Z build-std=std,core,alloc,panic_abort --target x86_64-unknown-hermit
env:
RUSTFLAGS: -Clinker-plugin-lto
- name: Build loader (unix)
Expand All @@ -98,6 +101,9 @@ jobs:
- name: Test release version
run:
qemu-system-x86_64 -display none -smp 1 -m 64M -serial stdio -kernel loader/target/x86_64-unknown-hermit-loader/debug/rusty-loader -initrd target/x86_64-unknown-hermit/release/rusty_demo -cpu qemu64,apic,fsgsbase,rdtscp,xsave,fxsr,rdrand
- name: Test release version (LTO)
run:
qemu-system-x86_64 -display none -smp 1 -m 64M -serial stdio -kernel loader/target/x86_64-unknown-hermit-loader/debug/rusty-loader -initrd target/x86_64-unknown-hermit/release-lto/rusty_demo -cpu qemu64,apic,fsgsbase,rdtscp,xsave,fxsr,rdrand
- name: Build httpd with DHCP support
run:
cargo build --manifest-path examples/httpd/Cargo.toml --features dhcpv4
Expand Down
32 changes: 30 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,50 @@ variables:
prepare:docker:
<<: *prepare_docker

build:instrument:
stage: build
image: ${CI_REGISTRY_IMAGE}
script:
- RUSTFLAGS="-Z instrument-mcount" cargo build -p rusty_demo --release --features=instrument
artifacts:
paths:
- target/x86_64-unknown-hermit/release/matrix_multiplcation

build:demo:
stage: build
image: ${CI_REGISTRY_IMAGE}
script:
- cargo build -p rusty_demo
- RUSTFLAGS="-Clinker-plugin-lto" cargo build -p rusty_demo --release
- cargo build -p rusty_demo --release
- RUSTFLAGS="-Clinker-plugin-lto" cargo build -p rusty_demo --profile release-lto -Z unstable-options
artifacts:
paths:
- target/x86_64-unknown-hermit/debug/rusty_demo
- target/x86_64-unknown-hermit/release/rusty_demo
- target/x86_64-unknown-hermit/release-lto/rusty_demo

build:httpd:
stage: build
image: ${CI_REGISTRY_IMAGE}
script:
- RUSTFLAGS="-Clinker-plugin-lto" cargo build --manifest-path examples/httpd/Cargo.toml --no-default-features --features pci,acpi,smoltcp,vga,dhcpv4 --release
- cargo build --manifest-path examples/httpd/Cargo.toml --no-default-features --features pci,acpi,smoltcp,vga,dhcpv4 --release
artifacts:
paths:
- target/x86_64-unknown-hermit/release/httpd

test:instrument:
stage: test
dependencies:
- build:instrument
image: ${CI_REGISTRY_IMAGE}
script:
- lscpu
- kvm-ok
- cargo install uhyve
- uhyve -v -c 1 target/x86_64-unknown-hermit/release/matrix_multiplcation
tags:
- privileged

test:uhyve:
stage: test
dependencies:
Expand All @@ -67,6 +91,8 @@ test:uhyve:
- uhyve -v -c 2 target/x86_64-unknown-hermit/debug/rusty_demo
- uhyve -v -c 1 target/x86_64-unknown-hermit/release/rusty_demo
- uhyve -v -c 2 target/x86_64-unknown-hermit/release/rusty_demo
- uhyve -v -c 1 target/x86_64-unknown-hermit/release-lto/rusty_demo
- uhyve -v -c 2 target/x86_64-unknown-hermit/release-lto/rusty_demo
tags:
- privileged

Expand All @@ -86,6 +112,8 @@ test:qemu:
- qemu-system-x86_64 -display none -smp 2 -m 64M -serial stdio -kernel loader/target/x86_64-unknown-hermit-loader/debug/rusty-loader -initrd target/x86_64-unknown-hermit/debug/rusty_demo -cpu qemu64,apic,fsgsbase,rdtscp,xsave,fxsr,rdrand -enable-kvm
- qemu-system-x86_64 -display none -smp 1 -m 64M -serial stdio -kernel loader/target/x86_64-unknown-hermit-loader/release/rusty-loader -initrd target/x86_64-unknown-hermit/release/rusty_demo -cpu qemu64,apic,fsgsbase,rdtscp,xsave,fxsr,rdrand -enable-kvm
- qemu-system-x86_64 -display none -smp 2 -m 64M -serial stdio -kernel loader/target/x86_64-unknown-hermit-loader/release/rusty-loader -initrd target/x86_64-unknown-hermit/release/rusty_demo -cpu qemu64,apic,fsgsbase,rdtscp,xsave,fxsr,rdrand -enable-kvm
- qemu-system-x86_64 -display none -smp 1 -m 64M -serial stdio -kernel loader/target/x86_64-unknown-hermit-loader/release/rusty-loader -initrd target/x86_64-unknown-hermit/release-lto/rusty_demo -cpu qemu64,apic,fsgsbase,rdtscp,xsave,fxsr,rdrand -enable-kvm
- qemu-system-x86_64 -display none -smp 2 -m 64M -serial stdio -kernel loader/target/x86_64-unknown-hermit-loader/release/rusty-loader -initrd target/x86_64-unknown-hermit/release-lto/rusty_demo -cpu qemu64,apic,fsgsbase,rdtscp,xsave,fxsr,rdrand -enable-kvm
tags:
- privileged

Expand Down
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cargo-features = ["named-profiles"]
[workspace]
members = [
"hermit-abi",
Expand All @@ -14,9 +15,13 @@ exclude = ["target", "loader", "libhermit-rs"]
opt-level = 3
debug = false
rpath = false
lto = "thin"
lto = false
debug-assertions = false

[profile.release-lto]
inherits = "release"
lto = "thin"

[profile.dev]
opt-level = 1 # controls the `--opt-level` the compiler builds with
debug = true # controls whether the compiler passes `-C debuginfo`
Expand Down
8 changes: 6 additions & 2 deletions benches/micro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cargo-features = ["named-profiles"]
[package]
name = "micro_benchmarks"
version = "0.1.0"
Expand Down Expand Up @@ -27,15 +28,18 @@ pci = ["hermit-sys/pci"]
acpi = ["hermit-sys/acpi"]
fsgsbase = ["hermit-sys/fsgsbase"]
smp = ["hermit-sys/smp"]
instrument = ["hermit-sys/instrument"]

[profile.release]
opt-level = 3
debug = false
rpath = false
lto = true
lto = false
debug-assertions = false

[profile.release-lto]
inherits = "release"
lto = "thin"

[profile.dev]
opt-level = 1 # controls the `--opt-level` the compiler builds with
debug = true # controls whether the compiler passes `-C debuginfo`
Expand Down
1 change: 0 additions & 1 deletion benches/micro/rust-toolchain

This file was deleted.

10 changes: 6 additions & 4 deletions benches/netbench/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
cargo-features = ["named-profiles"]
[package]

name = "rust-tcp-io-perf"
version = "0.0.0"
authors = ["Lorenzo Martini <[email protected]>"]
readme = "README.md"

description = "A Rust program to measure bandwidth or latency over a Rust TCP connection"

[dependencies]
Expand All @@ -27,7 +26,6 @@ acpi = ["hermit-sys/acpi"]
fsgsbase = ["hermit-sys/fsgsbase"]
smp = ["hermit-sys/smp"]
smoltcp = ["hermit-sys/smoltcp"]
instrument = ["hermit-sys/instrument"]

[[bin]]
name = "server-bw"
Expand All @@ -49,9 +47,13 @@ path = "src/rust-tcp-latency/client.rs"
opt-level = 3
debug = false
rpath = false
lto = true
lto = false
debug-assertions = false

[profile.release-lto]
inherits = "release"
lto = "thin"

[profile.dev]
opt-level = 1 # controls the `--opt-level` the compiler builds with
debug = true # controls whether the compiler passes `-C debuginfo`
Expand Down
13 changes: 11 additions & 2 deletions examples/demo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cargo-features = ["named-profiles"]
[package]
name = "rusty_demo"
version = "0.1.0"
Expand Down Expand Up @@ -33,22 +34,30 @@ default-features = false
[target.'cfg(target_os = "linux")'.dependencies]
syscalls = { version = "0.2", default-features = false }

[dependencies.rftrace-frontend]
version = "0.1.0"
optional = true

[features]
default = ["pci", "acpi", "smp"]
vga = ["hermit-sys/vga"]
pci = ["hermit-sys/pci"]
acpi = ["hermit-sys/acpi"]
fsgsbase = ["hermit-sys/fsgsbase"]
smp = ["hermit-sys/smp"]
instrument = ["hermit-sys/instrument"]
instrument = ["hermit-sys/instrument", "rftrace-frontend"]

[profile.release]
opt-level = 3
debug = false
rpath = false
lto = true
lto = false
debug-assertions = false

[profile.release-lto]
inherits = "release"
lto = "thin"

[profile.dev]
opt-level = 1 # controls the `--opt-level` the compiler builds with
debug = true # controls whether the compiler passes `-C debuginfo`
Expand Down
13 changes: 13 additions & 0 deletions examples/demo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@
extern crate hermit_sys;
extern crate num_cpus;
extern crate rayon;
#[cfg(feature = "instrument")]
extern crate rftrace_frontend;
#[cfg(target_os = "linux")]
#[macro_use]
extern crate syscalls;

mod tests;

#[cfg(feature = "instrument")]
use rftrace_frontend::Events;
use tests::*;

fn test_result<T>(result: Result<(), T>) -> &'static str {
Expand All @@ -29,6 +33,11 @@ fn test_result<T>(result: Result<(), T>) -> &'static str {
}

fn main() {
#[cfg(feature = "instrument")]
let events = rftrace_frontend::init(1000000, true);
#[cfg(feature = "instrument")]
rftrace_frontend::enable();

println!("Test {} ... {}", stringify!(hello), test_result(hello()));
println!(
"Test {} ... {}",
Expand Down Expand Up @@ -85,4 +94,8 @@ fn main() {
stringify!(thread_creation),
test_result(thread_creation())
);

#[cfg(feature = "instrument")]
rftrace_frontend::dump_full_uftrace(events, "trace", "rusty_demo", false)
.expect("Saving trace failed");
}
13 changes: 13 additions & 0 deletions examples/demo/src/matrix_multiplication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@
extern crate hermit_sys;
extern crate num_cpus;
extern crate rayon;
#[cfg(feature = "instrument")]
extern crate rftrace_frontend;
#[cfg(target_os = "linux")]
#[macro_use]
extern crate syscalls;

mod tests;

#[cfg(feature = "instrument")]
use rftrace_frontend::Events;
use tests::*;

fn test_result<T>(result: Result<(), T>) -> &'static str {
Expand All @@ -29,9 +33,18 @@ fn test_result<T>(result: Result<(), T>) -> &'static str {
}

fn main() {
#[cfg(feature = "instrument")]
let events = rftrace_frontend::init(1000000, true);
#[cfg(feature = "instrument")]
rftrace_frontend::enable();

println!(
"Test {} ... {}",
stringify!(test_matmul_strassen),
test_result(test_matmul_strassen())
);

#[cfg(feature = "instrument")]
rftrace_frontend::dump_full_uftrace(events, "trace", "matrix_multiplcation", false)
.expect("Saving trace failed");
}
13 changes: 13 additions & 0 deletions examples/demo/src/pi_sequential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@

#[cfg(target_os = "hermit")]
extern crate hermit_sys;
#[cfg(feature = "instrument")]
extern crate rftrace_frontend;
#[cfg(target_os = "linux")]
#[macro_use]
extern crate syscalls;

mod tests;

#[cfg(feature = "instrument")]
use rftrace_frontend::Events;
use tests::*;

fn test_result<T>(result: Result<(), T>) -> &'static str {
Expand All @@ -27,9 +31,18 @@ fn test_result<T>(result: Result<(), T>) -> &'static str {
}

fn main() {
#[cfg(feature = "instrument")]
let events = rftrace_frontend::init(1000000, true);
#[cfg(feature = "instrument")]
rftrace_frontend::enable();

println!(
"Test {} ... {}",
stringify!(pi_sequential),
test_result(pi_sequential(5000000))
);

#[cfg(feature = "instrument")]
rftrace_frontend::dump_full_uftrace(events, "trace", "pi_sequential", false)
.expect("Saving trace failed");
}
11 changes: 10 additions & 1 deletion examples/hello_world/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cargo-features = ["named-profiles"]
[package]
name = "hello_world"
version = "0.1.0"
Expand All @@ -10,14 +11,18 @@ path = "../../hermit-sys"
default-features = false
features = ["with_submodule"]

[dependencies.rftrace-frontend]
version = "0.1.0"
optional = true

[features]
default = ["pci", "acpi"]
vga = ["hermit-sys/vga"]
pci = ["hermit-sys/pci"]
acpi = ["hermit-sys/acpi"]
fsgsbase = ["hermit-sys/fsgsbase"]
smp = ["hermit-sys/smp"]
instrument = ["hermit-sys/instrument"]
instrument = ["hermit-sys/instrument", "rftrace-frontend"]

[profile.release]
opt-level = 3
Expand All @@ -26,6 +31,10 @@ rpath = false
lto = true
debug-assertions = false

[profile.release-lto]
inherits = "release"
lto = "thin"

[profile.dev]
opt-level = 1 # controls the `--opt-level` the compiler builds with
debug = true # controls whether the compiler passes `-C debuginfo`
Expand Down
Loading

0 comments on commit 91528f5

Please sign in to comment.