Skip to content

Commit

Permalink
Adding Modules to process explorer
Browse files Browse the repository at this point in the history
Fixes #1096
  • Loading branch information
ahmelsayed committed Apr 19, 2014
1 parent 30059b1 commit e2232bc
Show file tree
Hide file tree
Showing 9 changed files with 698 additions and 491 deletions.
3 changes: 3 additions & 0 deletions Kudu.Contracts/Diagnostics/ProcessInfo.cs
Expand Up @@ -36,6 +36,9 @@ public class ProcessInfo
[DataMember(Name = "open_file_handles", EmitDefaultValue = false)]
public IEnumerable<string> OpenFileHandles { get; set; }

[DataMember(Name = "modules", EmitDefaultValue = false)]
public IEnumerable<ProcessModuleInfo> Modules { get; set; }

[DataMember(Name = "file_name", EmitDefaultValue = false)]
public string FileName { get; set; }

Expand Down
43 changes: 43 additions & 0 deletions Kudu.Contracts/Diagnostics/ProcessModuleInfo.cs
@@ -0,0 +1,43 @@
using System;
using System.Runtime.Serialization;


namespace Kudu.Core.Diagnostics
{
[DataContract(Name = "processmodule")]
public class ProcessModuleInfo
{
[DataMember(Name = "base_address")]
public string BaseAddress { get; set; }

[DataMember(Name = "file_name")]
public string FileName { get; set; }

[DataMember(Name = "href", EmitDefaultValue = false)]
public Uri Href { get; set; }

[DataMember(Name = "file_path", EmitDefaultValue = false)]
public string FilePath { get; set; }

[DataMember(Name = "module_memory_size", EmitDefaultValue = false)]
public int ModuleMemorySize { get; set; }

[DataMember(Name = "file_version")]
public string FileVersion { get; set; }

[DataMember(Name = "file_description", EmitDefaultValue = false)]
public string FileDescription { get; set; }

[DataMember(Name = "product", EmitDefaultValue = false)]
public string Product { get; set; }

[DataMember(Name = "product_version", EmitDefaultValue = false)]
public string ProductVersion { get; set; }

[DataMember(Name = "is_debug", EmitDefaultValue = false)]
public bool? IsDebug { get; set; }

[DataMember(Name = "language", EmitDefaultValue = false)]
public string Language { get; set; }
}
}
1 change: 1 addition & 0 deletions Kudu.Contracts/Kudu.Contracts.csproj
Expand Up @@ -54,6 +54,7 @@
<Compile Include="Deployment\LogEntryType.cs" />
<Compile Include="Diagnostics\ApplicationLogEntry.cs" />
<Compile Include="Diagnostics\ProcessInfo.cs" />
<Compile Include="Diagnostics\ProcessModuleInfo.cs" />
<Compile Include="Diagnostics\ProcessThreadInfo.cs" />
<Compile Include="Diagnostics\RuntimeInfo.cs" />
<Compile Include="Editor\VfsStatEntry.cs" />
Expand Down
13 changes: 13 additions & 0 deletions Kudu.FunctionalTests/DiagnosticsApiFacts.cs
Expand Up @@ -117,6 +117,19 @@ public async Task ProcessApiTests()
}
}
//Test Handles
process = await appManager.ProcessManager.GetCurrentProcessAsync();
Assert.NotNull(process);
Assert.True(
process.OpenFileHandles.Any(
h => h.IndexOf("kudu.core.dll", StringComparison.InvariantCultureIgnoreCase) != -1));
//Test Modules
process = await appManager.ProcessManager.GetCurrentProcessAsync();
Assert.NotNull(process);
Assert.True(
process.Modules.Any(h => h.FileName.Equals("ntdll.dll", StringComparison.InvariantCultureIgnoreCase)));
// Test kill process
await KuduAssert.ThrowsUnwrappedAsync<HttpRequestException>(() => appManager.ProcessManager.KillProcessAsync(currentId));
HttpUtils.WaitForSite(appManager.SiteUrl, delayBeforeRetry: 10000);
Expand Down
2 changes: 2 additions & 0 deletions Kudu.Services.Web/App_Start/NinjectServices.cs
Expand Up @@ -403,6 +403,8 @@ public static void RegisterRoutes(IKernel kernel, RouteCollection routes)
}
routes.MapHttpRouteDual("all-threads", "diagnostics/processes/{id}/threads", new { controller = "Process", action = "GetAllThreads" }, new { verb = new HttpMethodConstraint("GET") });
routes.MapHttpRouteDual("one-process-thread", "diagnostics/processes/{processId}/threads/{threadId}", new { controller = "Process", action = "GetThread" }, new { verb = new HttpMethodConstraint("GET") });
routes.MapHttpRouteDual("all-modules", "diagnostics/processes/{id}/modules", new { controller = "Process", action = "GetAllModules" }, new { verb = new HttpMethodConstraint("GET") });
routes.MapHttpRouteDual("one-process-module", "diagnostics/processes/{id}/modules/{baseAddress}", new { controller = "Process", action = "GetModule" }, new { verb = new HttpMethodConstraint("GET") });

// Runtime
routes.MapHttpRouteDual("runtime", "diagnostics/runtime", new { controller = "Runtime", action = "GetRuntimeVersions" }, new { verb = new HttpMethodConstraint("GET") });
Expand Down

0 comments on commit e2232bc

Please sign in to comment.