Skip to content

Commit 81919fb

Browse files
committed
PCF viewer with additional execution time info
1 parent ea8b7af commit 81919fb

2 files changed

Lines changed: 28 additions & 10 deletions

File tree

src/AasxServerStandardBib/Credentials.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,16 @@ public static void bearerCheckAndInit(AasxCredentialsEntry c, AasxTaskService aa
300300
bool valid = true;
301301
if (c.bearerValidFrom > DateTime.UtcNow || c.bearerValidTo < DateTime.UtcNow)
302302
valid = false;
303-
if (valid)
303+
if (valid)
304+
{
305+
// Console.WriteLine("bearer token still valid");
304306
return;
307+
}
305308
}
306309

310+
Console.WriteLine("GET bearer token");
311+
var watch = System.Diagnostics.Stopwatch.StartNew();
312+
307313
c.bearer = string.Empty;
308314
c.bearerList.Clear();
309315

@@ -570,6 +576,7 @@ public static void bearerCheckAndInit(AasxCredentialsEntry c, AasxTaskService aa
570576
}
571577
}
572578
}
579+
Console.WriteLine($"{watch.ElapsedMilliseconds} ms");
573580

574581
if (exchange1 != "" && c.bearer != null && c.bearer != "")
575582
{
@@ -604,6 +611,7 @@ public static void bearerCheckAndInit(AasxCredentialsEntry c, AasxTaskService aa
604611
{
605612
c.bearer = tokenElement.GetString();
606613
Console.WriteLine("token exchange1 " + c.bearer);
614+
Console.WriteLine($"{watch.ElapsedMilliseconds} ms");
607615
}
608616
}
609617

@@ -640,6 +648,7 @@ public static void bearerCheckAndInit(AasxCredentialsEntry c, AasxTaskService aa
640648
{
641649
c.bearer = tokenElement.GetString();
642650
Console.WriteLine("token exchange2 " + c.bearer);
651+
Console.WriteLine($"{watch.ElapsedMilliseconds} ms");
643652
}
644653
}
645654

@@ -676,6 +685,7 @@ public static void bearerCheckAndInit(AasxCredentialsEntry c, AasxTaskService aa
676685
{
677686
c.bearer = tokenElement.GetString();
678687
Console.WriteLine("token exchange3 " + c.bearer);
688+
Console.WriteLine($"{watch.ElapsedMilliseconds} ms");
679689
}
680690
}
681691
}

src/IO.Swagger.Registry.Lib.V3/Services/RegistryInitializerService.cs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,9 @@ public async Task InitRegistry(List<AasxCredentialsEntry> cList, DateTime timest
290290

291291
if (getRegistryOfRegistry.Count != 0)
292292
{
293-
var requestPath = "";
293+
var requestPath = "";
294+
Console.WriteLine("GET RegistryOfRegistry");
295+
var watch = System.Diagnostics.Stopwatch.StartNew();
294296
foreach (var regOfReg in getRegistryOfRegistry)
295297
{
296298
requestPath = regOfReg;
@@ -350,7 +352,7 @@ public async Task InitRegistry(List<AasxCredentialsEntry> cList, DateTime timest
350352
var type = ep?["type"]?.GetValue<string>();
351353
if (string.Equals(type, "aas-registry", StringComparison.OrdinalIgnoreCase))
352354
{
353-
var url = ep?["url"]?.GetValue<string>();
355+
var url = ep?["url"]?.GetValue<string>()?.Trim();
354356
if (!string.IsNullOrWhiteSpace(url) &&
355357
!getRegistry.Contains(url, StringComparer.OrdinalIgnoreCase))
356358
{
@@ -368,7 +370,9 @@ public async Task InitRegistry(List<AasxCredentialsEntry> cList, DateTime timest
368370
{
369371
error = true;
370372
}
371-
}
373+
}
374+
watch.Stop();
375+
Console.WriteLine($"{watch.ElapsedMilliseconds} ms");
372376
}
373377

374378
if (getRegistry.Count != 0)
@@ -460,7 +464,9 @@ public async Task InitRegistry(List<AasxCredentialsEntry> cList, DateTime timest
460464

461465
aasDescriptorsForSubmodelView = [];
462466
foreach (var greg in getRegistry)
463-
{
467+
{
468+
Console.WriteLine("GET Registry");
469+
var watch = System.Diagnostics.Stopwatch.StartNew();
464470
var aasDescriptors = new List<AssetAdministrationShellDescriptor>();
465471
string? json = null;
466472
string? accessToken = null;
@@ -569,7 +575,9 @@ public async Task InitRegistry(List<AasxCredentialsEntry> cList, DateTime timest
569575
catch
570576
{
571577
error = true;
572-
}
578+
}
579+
Console.WriteLine($"{watch.ElapsedMilliseconds} ms");
580+
watch.Stop();
573581

574582
if (error)
575583
{
@@ -586,7 +594,7 @@ public async Task InitRegistry(List<AasxCredentialsEntry> cList, DateTime timest
586594
continue;
587595
}
588596

589-
var watch = System.Diagnostics.Stopwatch.StartNew();
597+
var watch1 = System.Diagnostics.Stopwatch.StartNew();
590598

591599
// check, if AAS is existing and must be replaced
592600
var extensions = new List<IExtension>();
@@ -850,13 +858,13 @@ public async Task InitRegistry(List<AasxCredentialsEntry> cList, DateTime timest
850858
}
851859
}
852860

853-
watch.Stop();
854-
Console.WriteLine($"{watch.ElapsedMilliseconds} ms");
861+
watch1.Stop();
862+
Console.WriteLine($"{watch1.ElapsedMilliseconds} ms");
855863

856864
Program.env[i] = newEnv;
857865
i++;
858866
}
859-
}
867+
}
860868
}
861869
}
862870
}

0 commit comments

Comments
 (0)