Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decouples Filesystem implementation #48

Merged
merged 15 commits into from
Jan 11, 2025
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ plist = "1.7.0"
regex = "1.11.1"
base64 = "0.22.1"
chrono = "0.4.38"
walkdir = "2.5.0"

[dev-dependencies]
simplelog = "0.12.2"
Expand Down
21 changes: 10 additions & 11 deletions benches/big_sur_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@
// 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.

use std::path::PathBuf;
use std::{fs::File, path::PathBuf};

use criterion::{criterion_group, criterion_main, Criterion};
use macos_unifiedlogs::{
dsc::SharedCacheStrings,
filesystem::LogarchiveProvider,
parser::{build_log, collect_shared_strings, collect_strings, collect_timesync, parse_log},
timesync::TimesyncBoot,
unified_log::UnifiedLogData,
uuidtext::UUIDText,
};

fn big_sur_parse_log(path: &str) {
let _ = parse_log(&path).unwrap();
let handle = File::open(PathBuf::from(path).as_path()).unwrap();
let _ = parse_log(handle).unwrap();
}

fn bench_build_log(
Expand Down Expand Up @@ -49,20 +51,17 @@ fn big_sur_single_log_benchpress(c: &mut Criterion) {
fn big_sur_build_log_benchbress(c: &mut Criterion) {
let mut test_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
test_path.push("tests/test_data/system_logs_big_sur.logarchive");
let string_results = collect_strings(&test_path.display().to_string()).unwrap();

test_path.push("dsc");
let shared_strings_results = collect_shared_strings(&test_path.display().to_string()).unwrap();
test_path.pop();

test_path.push("timesync");
let timesync_data = collect_timesync(&test_path.display().to_string()).unwrap();
test_path.pop();
let provider = LogarchiveProvider::new(test_path.as_path());
let string_results = collect_strings(&provider).unwrap();
let shared_strings_results = collect_shared_strings(&provider).unwrap();
let timesync_data = collect_timesync(&provider).unwrap();

test_path.push("Persist/0000000000000004.tracev3");
let exclude_missing = false;
let handle = File::open(test_path.as_path()).unwrap();

let log_data = parse_log(&test_path.display().to_string()).unwrap();
let log_data = parse_log(handle).unwrap();

c.bench_function("Benching Building One Big Sur Log", |b| {
b.iter(|| {
Expand Down
23 changes: 11 additions & 12 deletions benches/high_sierra_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@
// 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.

use std::path::PathBuf;
use std::{fs::File, path::PathBuf};

use criterion::{criterion_group, criterion_main, Criterion};
use macos_unifiedlogs::{
dsc::SharedCacheStrings,
filesystem::LogarchiveProvider,
parser::{build_log, collect_shared_strings, collect_strings, collect_timesync, parse_log},
timesync::TimesyncBoot,
unified_log::UnifiedLogData,
uuidtext::UUIDText,
};

fn high_sierra_parse_log(path: &str) {
let _ = parse_log(&path).unwrap();
let handle = File::open(PathBuf::from(path).as_path()).unwrap();
let _ = parse_log(handle).unwrap();
}

fn bench_build_log(
Expand Down Expand Up @@ -49,20 +52,16 @@ fn high_sierra_single_log_benchpress(c: &mut Criterion) {
fn high_sierra_build_log_benchbress(c: &mut Criterion) {
let mut test_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
test_path.push("tests/test_data/system_logs_high_sierra.logarchive");
let string_results = collect_strings(&test_path.display().to_string()).unwrap();

test_path.push("dsc");
let shared_strings_results = collect_shared_strings(&test_path.display().to_string()).unwrap();
test_path.pop();

test_path.push("timesync");
let timesync_data = collect_timesync(&test_path.display().to_string()).unwrap();
test_path.pop();
let provider = LogarchiveProvider::new(test_path.as_path());
let string_results = collect_strings(&provider).unwrap();
let shared_strings_results = collect_shared_strings(&provider).unwrap();
let timesync_data = collect_timesync(&provider).unwrap();

test_path.push("Persist/0000000000000002.tracev3");
let exclude_missing = false;
let handle = File::open(test_path.as_path()).unwrap();

let log_data = parse_log(&test_path.display().to_string()).unwrap();
let log_data = parse_log(handle).unwrap();

c.bench_function("Benching Building One High Sierra Log", |b| {
b.iter(|| {
Expand Down
21 changes: 10 additions & 11 deletions benches/monterey_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@
// 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.

use std::path::PathBuf;
use std::{fs::File, path::PathBuf};

use criterion::{criterion_group, criterion_main, Criterion};
use macos_unifiedlogs::{
dsc::SharedCacheStrings,
filesystem::LogarchiveProvider,
parser::{build_log, collect_shared_strings, collect_strings, collect_timesync, parse_log},
timesync::TimesyncBoot,
unified_log::UnifiedLogData,
uuidtext::UUIDText,
};
fn monterey_parse_log(path: &str) {
let _ = parse_log(&path).unwrap();
let handle = File::open(PathBuf::from(path).as_path()).unwrap();
let _ = parse_log(handle).unwrap();
}

fn bench_build_log(
Expand Down Expand Up @@ -48,20 +50,17 @@ fn monterey_single_log_benchpress(c: &mut Criterion) {
fn monterey_build_log_benchbress(c: &mut Criterion) {
let mut test_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
test_path.push("tests/test_data/system_logs_monterey.logarchive");
let string_results = collect_strings(&test_path.display().to_string()).unwrap();

test_path.push("dsc");
let shared_strings_results = collect_shared_strings(&test_path.display().to_string()).unwrap();
test_path.pop();

test_path.push("timesync");
let timesync_data = collect_timesync(&test_path.display().to_string()).unwrap();
test_path.pop();
let provider = LogarchiveProvider::new(test_path.as_path());
let string_results = collect_strings(&provider).unwrap();
let shared_strings_results = collect_shared_strings(&provider).unwrap();
let timesync_data = collect_timesync(&provider).unwrap();

test_path.push("Persist/0000000000000004.tracev3");
let exclude_missing = false;
let handle = File::open(test_path.as_path()).unwrap();

let log_data = parse_log(&test_path.display().to_string()).unwrap();
let log_data = parse_log(handle).unwrap();

c.bench_function("Benching Building One Monterey Log", |b| {
b.iter(|| {
Expand Down
7 changes: 1 addition & 6 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
[workspace]
members = [
"unifiedlog_parser",
"unifiedlog_parser_json",
"parse_tracev3",
"unifiedlog_iterator",
]
members = ["unifiedlog_parser"]
12 changes: 0 additions & 12 deletions examples/parse_tracev3/Cargo.toml

This file was deleted.

75 changes: 0 additions & 75 deletions examples/parse_tracev3/src/main.rs

This file was deleted.

15 changes: 0 additions & 15 deletions examples/unifiedlog_iterator/Cargo.toml

This file was deleted.

Loading
Loading