Skip to content
This repository has been archived by the owner on Jul 11, 2019. It is now read-only.

Commit

Permalink
0.10.7: Bump Version
Browse files Browse the repository at this point in the history
  • Loading branch information
mmstick committed Jan 18, 2017
1 parent 51eaf67 commit d99681f
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 101 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "parallel"
version = "0.10.6"
version = "0.10.7"
authors = ["Michael Aaron Murphy <mmstickman@gmail.com>"]
license = "MIT"
description = "Command-line CPU load balancer for executing jobs in parallel"
Expand Down
91 changes: 22 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,29 +40,11 @@ See the [to-do list](https://github.com/mmstick/parallel/blob/master/TODO.md) fo

```
~/D/parallel (master) $ seq 1 10000 | time -v /usr/bin/parallel echo > /dev/null
Command being timed: "/usr/bin/parallel echo"
User time (seconds): 194.73
System time (seconds): 66.49
Percent of CPU this job got: 230%
Elapsed (wall clock) time (h:mm:ss or m:ss): 1:53.08
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 16140
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 10329017
Voluntary context switches: 102095
Involuntary context switches: 229910
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
```

#### Cat the contents of every binary in /usr/bin
Expand All @@ -73,24 +55,18 @@ See the [to-do list](https://github.com/mmstick/parallel/blob/master/TODO.md) fo
System time (seconds): 27.67
Percent of CPU this job got: 222%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:44.62
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 17576
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 8
Minor (reclaiming a frame) page faults: 4112045
Voluntary context switches: 51331
Involuntary context switches: 101494
Swaps: 0
File system inputs: 1512
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 5
```

#### Logging echo ::: $(seq 1 1000)

```
~/D/parallel (master) $ time -v /usr/bin/parallel --joblog log echo ::: $(seq 1 1000) > /dev/null
User time (seconds): 21.27
System time (seconds): 7.44
Percent of CPU this job got: 238%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:12.05
Maximum resident set size (kbytes): 16624
```

### Rust Parallel (Built with MUSL target)
Expand All @@ -106,24 +82,7 @@ Command being timed: "target/x86_64-unknown-linux-musl/release/parallel echo"
System time (seconds): 2.85
Percent of CPU this job got: 104%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:03.20
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 1768
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 823754
Voluntary context switches: 82723
Involuntary context switches: 64834
Swaps: 0
File system inputs: 0
File system outputs: 320
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
```

#### Cat the contents of every binary in /usr/bin
Expand All @@ -134,24 +93,18 @@ Command being timed: "target/x86_64-unknown-linux-musl/release/parallel echo"
System time (seconds): 4.61
Percent of CPU this job got: 192%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:02.89
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 1868
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 350216
Voluntary context switches: 68772
Involuntary context switches: 40085
Swaps: 0
File system inputs: 368
File system outputs: 416
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
```

#### Logging echo ::: $(seq 1 1000)

```
~/D/parallel (master) $ time -v target/release/x86_64-unknown-linux-musl/release/parallel --joblog log echo ::: $(seq 1 1000)
User time (seconds): 0.06
System time (seconds): 0.29
Percent of CPU this job got: 70%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.51
Maximum resident set size (kbytes): 1768
```

## Syntax Examples
Expand Down
6 changes: 3 additions & 3 deletions src/arguments/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ impl Args {
}
}
_ if &argument[2..9] == "shebang" => {
shebang = true;
comm.push_str(&argument[10..]);
break
shebang = true;
comm.push_str(&argument[10..]);
break
},
_ => return Err(ParseErr::InvalidArgument(index-1)),
}
Expand Down
46 changes: 21 additions & 25 deletions src/execute/job_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,77 +25,73 @@ pub struct JobLog {
impl JobLog {
/// Writes an individual job log to the job log file, efficiently.
pub fn write_entry(&self, joblog: &mut File, id_buffer: &mut [u8], pad: usize) {
let mut start_indice;
// 1: JobID
let mut joblog = BufWriter::new(joblog);
start_indice = (self.job_id + 1).numtoa(10, id_buffer);
let _ = joblog.write(&id_buffer[start_indice..]);
for _ in 0..pad-id_buffer[start_indice..].len() {
let mut index = (self.job_id + 1).numtoa(10, id_buffer);
let _ = joblog.write(&id_buffer[index..]);
for _ in 0..pad - (20 - index) {
let _ = joblog.write(b" ");
}

// 2: StartTime
if self.flags & JOBLOG_8601 != 0 {
// ISO 8601 representation of the time
let tm = at(self.start_time);
// TODO: Eliminate heap allocation
let message = format!("{}-{:02}-{:02} {:02}:{:02}:{:02} ", 1900+tm.tm_year, 1+tm.tm_mon,
let _ = write!(joblog, "{}-{:02}-{:02} {:02}:{:02}:{:02} ", 1900+tm.tm_year, 1+tm.tm_mon,
tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
let _ = joblog.write(message.as_bytes());

} else {
// Represented in seconds, with two decimal places
// TODO: write an abstraction for printing decimals
start_indice = self.start_time.sec.numtoa(10, id_buffer);
let _ = joblog.write(&id_buffer[start_indice..]);
index = self.start_time.sec.numtoa(10, id_buffer);
let _ = joblog.write(&id_buffer[index..]);
let _ = joblog.write(b".");
let decimal = (self.start_time.nsec % 1_000_000_000) / 1_000_000;
if decimal == 0 {
let _ = joblog.write(b"000");
} else {
start_indice = decimal.numtoa(10, id_buffer);
match id_buffer[start_indice..].len() {
index = decimal.numtoa(10, id_buffer);
match 20 - index {
1 => { let _ = joblog.write(b"00"); },
2 => { let _ = joblog.write(b"0"); },
_ => (),
};
let _ = joblog.write(&id_buffer[start_indice..]);
let _ = joblog.write(&id_buffer[index..]);
}
let _ = joblog.write(b" ");
}

// 3: Runtime in seconds, with up to three decimal places.
start_indice = (self.runtime / 1_000_000_000).numtoa(10, id_buffer);
for _ in 0..6-id_buffer[start_indice..].len() {
index = (self.runtime / 1_000_000_000).numtoa(10, id_buffer);
for _ in 0..6 - (20 - index) {
let _ = joblog.write(b" ");
}
let _ = joblog.write(&id_buffer[start_indice..]);
let _ = joblog.write(&id_buffer[index..]);
let _ = joblog.write(b".");
let decimal = (self.runtime % 1_000_000_000) / 1_000_000;
if decimal == 0 {
let _ = joblog.write(b"000");
} else {
start_indice = decimal.numtoa(10, id_buffer);
match id_buffer[start_indice..].len() {
index = decimal.numtoa(10, id_buffer);
match 20 - index {
1 => { let _ = joblog.write(b"00"); },
2 => { let _ = joblog.write(b"0"); },
_ => (),
};
let _ = joblog.write(&id_buffer[start_indice..]);
let _ = joblog.write(&id_buffer[index..]);
}
let _ = joblog.write(b" ");

// 4: Exit Value
start_indice = self.exit_value.numtoa(10, id_buffer);
let _ = joblog.write(&id_buffer[start_indice..]);
for _ in 0..9-id_buffer[start_indice..].len() {
index = self.exit_value.numtoa(10, id_buffer);
let _ = joblog.write(&id_buffer[index..]);
for _ in 0..9 - (20 - index) {
let _ = joblog.write(b" ");
}

// 5: Signal
start_indice = self.signal.numtoa(10, id_buffer);
let _ = joblog.write(&id_buffer[start_indice..]);
for _ in 0..8-id_buffer[start_indice..].len() {
index = self.signal.numtoa(10, id_buffer);
let _ = joblog.write(&id_buffer[index..]);
for _ in 0..8 - (20 - index) {
let _ = joblog.write(b" ");
}

Expand Down
4 changes: 2 additions & 2 deletions src/execute/receive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ pub fn receive_messages(input_rx: Receiver<State>, args: Args, base: &str, proce
let mut stdout = stdout.lock();
let mut stderr = stderr.lock();
let mut bytes_read = stdout_file.read(&mut read_buffer).unwrap();
if bytes_read != 0 { stdout.write(&read_buffer[0..bytes_read]).unwrap(); }
if bytes_read != 0 { stdout.write_all(&read_buffer[0..bytes_read]).unwrap(); }

bytes_read = stderr_file.read(&mut read_buffer).unwrap();
if bytes_read != 0 { stderr.write(&read_buffer[0..bytes_read]).unwrap(); }
if bytes_read != 0 { stderr.write_all(&read_buffer[0..bytes_read]).unwrap(); }
thread::sleep(Duration::from_millis(1));
}
}
Expand Down

0 comments on commit d99681f

Please sign in to comment.