public class ProfileAnalyzer extends Object
ProfilingListener
and TensorFlow's profiler.
See ProfilingListener
See TraceEvent
Modifier and Type | Class and Description |
---|---|
static class |
ProfileAnalyzer.OutputFormat
TEXT: Human readable, columns padded for alignment
CSV: CSV format, comma separated |
static class |
ProfileAnalyzer.ProfileFormat
Chrome profiler supports 2 formats:
SameDiff == JSON Array Format TensorFlow == JSON Object Format |
static class |
ProfileAnalyzer.SortBy
Only applicable for profile comparisons.
PROFILE1_PC - sort by profile 1 percentage of total time PROFILE2_PC - sort by profile 2 percentage of total time RATIO - sort by highest ratio (mean op time profile 1 / mean op time profile 2) |
Constructor and Description |
---|
ProfileAnalyzer() |
Modifier and Type | Method and Description |
---|---|
static String |
compareProfiles(Config c) |
static String |
compareProfiles(@NonNull File file1,
@NonNull File file2,
@NonNull ProfileAnalyzer.ProfileFormat format1,
@NonNull ProfileAnalyzer.ProfileFormat format2)
Compare the specified profile files, sorted by profile 1 % of total time
|
static String |
compareProfiles(@NonNull File file1,
@NonNull File file2,
@NonNull ProfileAnalyzer.ProfileFormat format1,
@NonNull ProfileAnalyzer.ProfileFormat format2,
boolean firstIsDir,
boolean secondIsDir,
String name1,
String name2,
ProfileAnalyzer.SortBy sortBy)
Compare the specified profile files or directory
|
static TraceEvent[] |
getTraceEvents(File file,
ProfileAnalyzer.ProfileFormat profileFormat)
Load and return the TraceEvent object from the specified profile file
|
static TraceEvent[] |
getTraceEvents(File file,
ProfileAnalyzer.ProfileFormat profileFormat,
boolean aggregateTFSubOps) |
static TraceEvent[] |
getTraceEventsDir(File dir,
ProfileAnalyzer.ProfileFormat profileFormat)
Load, aggregate and return the TraceEvent object from all profiles in the specified directory
|
static void |
summarizeProfile(File file,
ProfileAnalyzer.ProfileFormat profileFormat)
Summarize and print to stdout the specified profile file
|
static void |
summarizeProfileDirectory(File dir,
ProfileAnalyzer.ProfileFormat profileFormat)
Aggregate, summarize and print to stdout all .json profile files in the specified directory (not recursive)
|
static String |
summarizeProfileDirectoryStr(File dir,
ProfileAnalyzer.ProfileFormat profileFormat)
Aggregate, summarize and return as a String all .json profile files in the specified directory (not recursive)
|
static String |
summarizeProfileStr(File file,
ProfileAnalyzer.ProfileFormat profileFormat)
Summarize and return as a string the specified profile file
|
static String |
summarizeTraceEvents(TraceEvent[] events)
Summarize the specified TraceEvents as a String
|
public static void summarizeProfile(File file, ProfileAnalyzer.ProfileFormat profileFormat)
file
- Profile fileprofileFormat
- Format of the profiler filepublic static String summarizeProfileStr(File file, ProfileAnalyzer.ProfileFormat profileFormat)
file
- Profile fileprofileFormat
- Format of the profiler filepublic static void summarizeProfileDirectory(File dir, ProfileAnalyzer.ProfileFormat profileFormat)
dir
- Directory containing the profilesprofileFormat
- Profile formatpublic static String summarizeProfileDirectoryStr(File dir, ProfileAnalyzer.ProfileFormat profileFormat)
dir
- Directory containing the profilesprofileFormat
- Profile formatpublic static TraceEvent[] getTraceEventsDir(File dir, ProfileAnalyzer.ProfileFormat profileFormat)
dir
- Directory containing the profilesprofileFormat
- Profile formatpublic static TraceEvent[] getTraceEvents(File file, ProfileAnalyzer.ProfileFormat profileFormat)
file
- Profile fileprofileFormat
- Profile formatpublic static TraceEvent[] getTraceEvents(File file, ProfileAnalyzer.ProfileFormat profileFormat, boolean aggregateTFSubOps)
public static String summarizeTraceEvents(TraceEvent[] events)
events
- Events to summarizepublic static String compareProfiles(@NonNull @NonNull File file1, @NonNull @NonNull File file2, @NonNull @NonNull ProfileAnalyzer.ProfileFormat format1, @NonNull @NonNull ProfileAnalyzer.ProfileFormat format2)
file1
- First profile filefile2
- Second profile fileformat1
- Format of first profileformat2
- Format of second profilepublic static String compareProfiles(@NonNull @NonNull File file1, @NonNull @NonNull File file2, @NonNull @NonNull ProfileAnalyzer.ProfileFormat format1, @NonNull @NonNull ProfileAnalyzer.ProfileFormat format2, boolean firstIsDir, boolean secondIsDir, String name1, String name2, ProfileAnalyzer.SortBy sortBy)
file1
- First profile file or directory of profilesfile2
- Second profile file or directory of profilesformat1
- Format for first profile file/sformat2
- Format for second profile file/sfirstIsDir
- True if the first File object is a directorysecondIsDir
- True if the second File object is a directoryname1
- Name of the first profile (just for display purposes). Optionalname2
- Name of the second profile (just for display purposes). OptionalsortBy
- What to sort the summary results byCopyright © 2020. All rights reserved.