Skip to content

Commit

Permalink
[Perf] Update Profile Directory (#5404)
Browse files Browse the repository at this point in the history
  • Loading branch information
alzimmermsft authored Feb 10, 2023
1 parent 6b006ea commit 47b1bd4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/Java.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ public override async Task<IterationResult> 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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"));
}
}

Expand Down
12 changes: 12 additions & 0 deletions tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,17 @@ public static void DeleteIfExists(string path)
}
}
}

/// <summary>
/// Gets the directory where profiles should be written to during performance testing.
///
/// The directory is based on the repository root folder.
/// </summary>
/// <param name="repoRoot">The repository root folder path.</param>
/// <returns>The directory where profiles should be written.</returns>
public static string GetProfileDirectory(string repoRoot)
{
return Path.Combine(repoRoot, "profile");
}
}
}

0 comments on commit 47b1bd4

Please sign in to comment.