-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e38c86f
commit b6c4d86
Showing
6 changed files
with
277 additions
and
277 deletions.
There are no files selected for viewing
Empty file.
34 changes: 17 additions & 17 deletions
34
lib/src/main/java/org/frc5572/util/profiler/ProfileLoggingFormat.java
100644 → 100755
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 |
---|---|---|
@@ -1,17 +1,17 @@ | ||
package org.frc5572.util.profiler; | ||
|
||
import java.io.OutputStream; | ||
|
||
import org.frc5572.util.profiler.LoggingProfiler.LocatedInfo; | ||
|
||
public interface ProfileLoggingFormat { | ||
|
||
public int compare(String leftName, LocatedInfo leftInfo, String rightName, LocatedInfo rightInfo); | ||
|
||
public void write(String name, LocatedInfo info, double timeDivisor, OutputStream outStream); | ||
|
||
public void begin(OutputStream outputStream); | ||
|
||
public void end(OutputStream outputStream); | ||
|
||
} | ||
package org.frc5572.util.profiler; | ||
|
||
import java.io.OutputStream; | ||
|
||
import org.frc5572.util.profiler.LoggingProfiler.LocatedInfo; | ||
|
||
public interface ProfileLoggingFormat { | ||
|
||
public int compare(String leftName, LocatedInfo leftInfo, String rightName, LocatedInfo rightInfo); | ||
|
||
public void write(String name, LocatedInfo info, double timeDivisor, OutputStream outStream); | ||
|
||
public void begin(OutputStream outputStream); | ||
|
||
public void end(OutputStream outputStream); | ||
|
||
} |
96 changes: 48 additions & 48 deletions
96
lib/src/main/java/org/frc5572/util/profiler/TextProfileLoggingFormat.java
100644 → 100755
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 |
---|---|---|
@@ -1,48 +1,48 @@ | ||
package org.frc5572.util.profiler; | ||
|
||
import java.io.IOException; | ||
import java.io.OutputStream; | ||
|
||
import org.frc5572.util.profiler.LoggingProfiler.LocatedInfo; | ||
|
||
public class TextProfileLoggingFormat implements ProfileLoggingFormat { | ||
|
||
private TextProfileLoggingFormat() {} | ||
|
||
public static final TextProfileLoggingFormat INSTANCE = new TextProfileLoggingFormat(); | ||
|
||
@Override | ||
public int compare(String leftName, LocatedInfo leftInfo, String rightName, LocatedInfo rightInfo) { | ||
return -Long.compare(leftInfo.totalTime, rightInfo.totalTime); | ||
} | ||
|
||
@Override | ||
public void write(String name, LocatedInfo info, double timeDivisor, OutputStream outStream) { | ||
try { | ||
outStream.write((name + "\n").getBytes()); | ||
outStream.write((" visitCount: " + info.getVisitCount() + "\n").getBytes()); | ||
outStream.write((" totalTime: " + info.getTotalTime() / timeDivisor + "\n").getBytes()); | ||
outStream.write((" maxTime: " + info.getMaxTime() / timeDivisor + "\n").getBytes()); | ||
outStream.write((" minTime: " + info.minTime / timeDivisor + "\n").getBytes()); | ||
outStream.write((" avgTime: " + info.getTotalTime() / info.getVisitCount() / timeDivisor + "\n").getBytes()); | ||
} catch(IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
@Override | ||
public void begin(OutputStream outputStream) { | ||
try { | ||
outputStream.write(("Performance Log\n" + // | ||
"================================================================================\n").getBytes()); | ||
} catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
@Override | ||
public void end(OutputStream outputStream) { | ||
|
||
} | ||
|
||
} | ||
package org.frc5572.util.profiler; | ||
|
||
import java.io.IOException; | ||
import java.io.OutputStream; | ||
|
||
import org.frc5572.util.profiler.LoggingProfiler.LocatedInfo; | ||
|
||
public class TextProfileLoggingFormat implements ProfileLoggingFormat { | ||
|
||
private TextProfileLoggingFormat() {} | ||
|
||
public static final TextProfileLoggingFormat INSTANCE = new TextProfileLoggingFormat(); | ||
|
||
@Override | ||
public int compare(String leftName, LocatedInfo leftInfo, String rightName, LocatedInfo rightInfo) { | ||
return -Long.compare(leftInfo.totalTime, rightInfo.totalTime); | ||
} | ||
|
||
@Override | ||
public void write(String name, LocatedInfo info, double timeDivisor, OutputStream outStream) { | ||
try { | ||
outStream.write((name + "\n").getBytes()); | ||
outStream.write((" visitCount: " + info.getVisitCount() + "\n").getBytes()); | ||
outStream.write((" totalTime: " + info.getTotalTime() / timeDivisor + "\n").getBytes()); | ||
outStream.write((" maxTime: " + info.getMaxTime() / timeDivisor + "\n").getBytes()); | ||
outStream.write((" minTime: " + info.minTime / timeDivisor + "\n").getBytes()); | ||
outStream.write((" avgTime: " + info.getTotalTime() / info.getVisitCount() / timeDivisor + "\n").getBytes()); | ||
} catch(IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
@Override | ||
public void begin(OutputStream outputStream) { | ||
try { | ||
outputStream.write(("Performance Log\n" + // | ||
"================================================================================\n").getBytes()); | ||
} catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
@Override | ||
public void end(OutputStream outputStream) { | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.