diff --git a/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/Java.cs b/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/Java.cs index 78c410c1bf1..08d14beaea9 100644 --- a/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/Java.cs +++ b/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/Java.cs @@ -127,8 +127,8 @@ public override async Task RunAsync( var profilingConfig = ""; if (profile) { - var profileOutputPath = Path.GetFullPath(Path.Combine(ProfileDirectory, $"{testName}_{profileCount++}.jfr")); - profilingConfig = $"-XX:+FlightRecorder -XX:StartFlightRecording=filename={profileOutputPath},maxsize=1gb"; + var profileOutputPath = Path.GetFullPath(Path.Combine(Util.GetProfileDirectory(WorkingDirectory), $"{testName}_{profileCount++}.jfr")); + profilingConfig = $"-XX:StartFlightRecording=filename={profileOutputPath},maxsize=1gb"; // If Java 8 is the version of Java being used add '-XX:+UnlockCommercialFeatures' as that is required to run Java Flight Recording in Java 8. // Don't add '-XX:+UnlockCommercialFeatures' if it is any other version as this causes the JVM to crash on an unrecognized VM options. diff --git a/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/LanguageBase.cs b/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/LanguageBase.cs index 95278e159ca..0918be74271 100644 --- a/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/LanguageBase.cs +++ b/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/LanguageBase.cs @@ -9,8 +9,6 @@ public abstract class LanguageBase : ILanguage { protected abstract Language Language { get; } - protected string ProfileDirectory => Path.GetFullPath(Path.Combine(WorkingDirectory, Language + "-profile")); - public string WorkingDirectory { get; set; } public abstract Task CleanupAsync(string project); diff --git a/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/Program.cs b/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/Program.cs index ad17c985a5e..797c286f938 100644 --- a/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/Program.cs +++ b/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/Program.cs @@ -209,7 +209,7 @@ private static async Task Run(Options options) if (options.Profile) { - profileDirectory = Directory.CreateDirectory(Path.Combine(options.RepoRoot, "profile")); + profileDirectory = Directory.CreateDirectory(Util.GetProfileDirectory(options.RepoRoot)); } foreach (var packageVersions in selectedPackageVersions) @@ -230,7 +230,7 @@ await RunPackageVersion( if (options.Profile) { - ZipFile.CreateFromDirectory(profileDirectory.FullName, Path.Combine(profileDirectory.Parent.FullName, profileDirectory.Name + ".zip")); + ZipFile.CreateFromDirectory(profileDirectory.FullName, Path.Combine(profileDirectory.Parent.FullName, $"{options.Language}-{profileDirectory.Name}.zip")); } } diff --git a/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/Util.cs b/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/Util.cs index 2cc3f154aab..4a817f16b74 100644 --- a/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/Util.cs +++ b/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/Util.cs @@ -109,5 +109,17 @@ public static void DeleteIfExists(string path) } } } + + /// + /// Gets the directory where profiles should be written to during performance testing. + /// + /// The directory is based on the repository root folder. + /// + /// The repository root folder path. + /// The directory where profiles should be written. + public static string GetProfileDirectory(string repoRoot) + { + return Path.Combine(repoRoot, "profile"); + } } }