Class ProfileAnalyzer
- java.lang.Object
-
- org.nd4j.autodiff.listeners.profiler.comparison.ProfileAnalyzer
-
public class ProfileAnalyzer extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ProfileAnalyzer.OutputFormat
TEXT: Human readable, columns padded for alignment
CSV: CSV format, comma separatedstatic class
ProfileAnalyzer.ProfileFormat
Chrome profiler supports 2 formats:
SameDiff == JSON Array Format
TensorFlow == JSON Object Formatstatic 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 Summary
Constructors Constructor Description ProfileAnalyzer()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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 timestatic 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 directorystatic String
compareProfiles(Config c)
static TraceEvent[]
getTraceEvents(File file, ProfileAnalyzer.ProfileFormat profileFormat)
Load and return the TraceEvent object from the specified profile filestatic 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 directorystatic void
summarizeProfile(File file, ProfileAnalyzer.ProfileFormat profileFormat)
Summarize and print to stdout the specified profile filestatic 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 filestatic String
summarizeTraceEvents(TraceEvent[] events)
Summarize the specified TraceEvents as a String
-
-
-
Method Detail
-
summarizeProfile
public static void summarizeProfile(File file, ProfileAnalyzer.ProfileFormat profileFormat)
Summarize and print to stdout the specified profile file- Parameters:
file
- Profile fileprofileFormat
- Format of the profiler file
-
summarizeProfileStr
public static String summarizeProfileStr(File file, ProfileAnalyzer.ProfileFormat profileFormat)
Summarize and return as a string the specified profile file- Parameters:
file
- Profile fileprofileFormat
- Format of the profiler file
-
summarizeProfileDirectory
public static void summarizeProfileDirectory(File dir, ProfileAnalyzer.ProfileFormat profileFormat)
Aggregate, summarize and print to stdout all .json profile files in the specified directory (not recursive)- Parameters:
dir
- Directory containing the profilesprofileFormat
- Profile format
-
summarizeProfileDirectoryStr
public 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)- Parameters:
dir
- Directory containing the profilesprofileFormat
- Profile format
-
getTraceEventsDir
public static TraceEvent[] getTraceEventsDir(File dir, ProfileAnalyzer.ProfileFormat profileFormat)
Load, aggregate and return the TraceEvent object from all profiles in the specified directory- Parameters:
dir
- Directory containing the profilesprofileFormat
- Profile format
-
getTraceEvents
public static TraceEvent[] getTraceEvents(File file, ProfileAnalyzer.ProfileFormat profileFormat)
Load and return the TraceEvent object from the specified profile file- Parameters:
file
- Profile fileprofileFormat
- Profile format
-
getTraceEvents
public static TraceEvent[] getTraceEvents(File file, ProfileAnalyzer.ProfileFormat profileFormat, boolean aggregateTFSubOps)
-
summarizeTraceEvents
public static String summarizeTraceEvents(TraceEvent[] events)
Summarize the specified TraceEvents as a String- Parameters:
events
- Events to summarize
-
compareProfiles
public static String compareProfiles(@NonNull @NonNull File file1, @NonNull @NonNull File file2, @NonNull @NonNull ProfileAnalyzer.ProfileFormat format1, @NonNull @NonNull ProfileAnalyzer.ProfileFormat format2)
Compare the specified profile files, sorted by profile 1 % of total time- Parameters:
file1
- First profile filefile2
- Second profile fileformat1
- Format of first profileformat2
- Format of second profile- Returns:
- Comparison summary as a String
-
compareProfiles
public 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)
Compare the specified profile files or directory- Parameters:
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 by- Returns:
- Comparison summary as a String
-
-