-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify AuditReplay workflow to output count and latency of operations…
… (PR #92)
- Loading branch information
1 parent
9e4899c
commit 66d3e19
Showing
6 changed files
with
120 additions
and
26 deletions.
There are no files selected for viewing
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
71 changes: 71 additions & 0 deletions
71
...oad/src/main/java/com/linkedin/dynamometer/workloadgenerator/audit/CountTimeWritable.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,71 @@ | ||
/* | ||
* Copyright 2019 LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license. | ||
* See LICENSE in the project root for license information. | ||
*/ | ||
package com.linkedin.dynamometer.workloadgenerator.audit; | ||
|
||
import org.apache.hadoop.io.LongWritable; | ||
import org.apache.hadoop.io.Writable; | ||
|
||
import java.io.DataInput; | ||
import java.io.DataOutput; | ||
import java.io.IOException; | ||
|
||
|
||
/** | ||
* UserCommandKey is a {@link Writable} used as a composite value that accumulates the count | ||
* and cumulative latency of replayed commands. It is used as the output value for | ||
* AuditReplayMapper and AuditReplayReducer. | ||
*/ | ||
public class CountTimeWritable implements Writable { | ||
private LongWritable count; | ||
private LongWritable time; | ||
|
||
public CountTimeWritable() { | ||
count = new LongWritable(); | ||
time = new LongWritable(); | ||
} | ||
|
||
public CountTimeWritable(LongWritable count, LongWritable time) { | ||
this.count = count; | ||
this.time = time; | ||
} | ||
|
||
public CountTimeWritable(long count, long time) { | ||
this.count = new LongWritable(count); | ||
this.time = new LongWritable(time); | ||
} | ||
|
||
public long getCount() { | ||
return count.get(); | ||
} | ||
|
||
public long getTime() { | ||
return time.get(); | ||
} | ||
|
||
public void setCount(long count) { | ||
this.count.set(getCount() + count); | ||
} | ||
|
||
public void setTime(long time) { | ||
this.time.set(getTime() + time); | ||
} | ||
|
||
@Override | ||
public void write(DataOutput out) throws IOException { | ||
count.write(out); | ||
time.write(out); | ||
} | ||
|
||
@Override | ||
public void readFields(DataInput in) throws IOException { | ||
count.readFields(in); | ||
time.readFields(in); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return getCount() + "," + getTime(); | ||
} | ||
} |
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