-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add --collect-spmi-to to collect SPMI collections
When used, it should point to an existing directory in which SPMI collections of all of the host invocations will be created. It requires the SPMI shim to exist next to the host.
- Loading branch information
1 parent
c10b52e
commit 3aecec6
Showing
7 changed files
with
118 additions
and
7 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Fuzzlyn; | ||
|
||
internal class SpmiSetupOptions | ||
{ | ||
public string CollectionDirectory { get; private set; } | ||
public string ShimPath { get; private set; } | ||
public string ShimName { get; private set; } | ||
public string JitPath { get; private set; } | ||
|
||
public static SpmiSetupOptions Create(string collectionDir, string host, out string error) | ||
{ | ||
if (!Directory.Exists(collectionDir)) | ||
{ | ||
error = $"SPMI collection directory {collectionDir} does not exist"; | ||
return null; | ||
} | ||
|
||
SpmiSetupOptions options = new() | ||
{ | ||
CollectionDirectory = collectionDir | ||
}; | ||
|
||
string hostDir = Path.GetDirectoryName(host); | ||
(string shimName, string jitName)[] setups = | ||
{ | ||
("superpmi-shim-collector.dll", "clrjit.dll"), | ||
("libsuperpmi-shim-collector.so", "libclrjit.so"), | ||
("libsuperpmi-shim-collector.dylib", "libclrjit.dylib") | ||
}; | ||
|
||
foreach ((string shimName, string jitName) in setups) | ||
{ | ||
string shimPath = Path.Combine(hostDir, shimName); | ||
if (!File.Exists(shimPath)) | ||
{ | ||
continue; | ||
} | ||
|
||
string jitPath = Path.Combine(hostDir, jitName); | ||
if (!File.Exists(jitPath)) | ||
{ | ||
error = $"Expected JIT to exist next to SPMI shim (at {jitPath})"; | ||
return null; | ||
} | ||
|
||
options.ShimPath = shimPath; | ||
options.ShimName = shimName; | ||
options.JitPath = jitPath; | ||
error = null; | ||
return options; | ||
} | ||
|
||
error = $"Could not find an SPMI shim in host directory {hostDir}"; | ||
return null; | ||
} | ||
} |