You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/net-aspire/modify_project.md
+11-9Lines changed: 11 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,9 +8,11 @@ layout: learningpathall
8
8
9
9
## Modify the Project
10
10
11
-
Now modify the project to add additional computations to mimic computationally-intensive work.
11
+
Now you can move on to add additional computations to mimic computationally-intensive work.
12
12
13
-
You will now include additional code for the purpose of demonstrating computation intense work. Go to the `NetAspire.Arm.ApiService` project, and create a new file `ComputationService.cs`. Add the code shown below to this file:
13
+
Go to the `NetAspire.Arm.ApiService` project, and create a new file, and name it `ComputationService.cs`.
14
+
15
+
Add the code shown below to this file:
14
16
15
17
```cs
16
18
staticclassComputationService
@@ -43,15 +45,15 @@ static class ComputationService
43
45
}
44
46
```
45
47
46
-
This code defines a static class, ComputationService, designed to perform computationallyintensive tasks, specifically matrix multiplication. It contains a public method, PerformIntensiveCalculations, which generates two matrices of a specified size, multiplies them, and stores the resulting matrix.
48
+
This code defines a static class, ComputationService, designed to perform computationally-intensive tasks; in particular, matrix multiplication. It contains a public method, PerformIntensiveCalculations, which generates two matrices of a specified size, multiplies them, and stores the resulting matrix.
47
49
48
-
The private method GenerateMatrix creates a one-dimensional array representing a matrix of the given size (matrixSize x matrixSize). Each element in the matrix is initialized with a random doublevalue generated using Random.Shared.NextDouble().
50
+
*The private method, GenerateMatrix, creates a one-dimensional array representing a matrix of the given size (matrixSize x matrixSize). Each element in the matrix is initialized with a random double-value generated using Random.Shared.NextDouble().
49
51
50
-
The public method PerformIntensiveCalculations multiplies two matrices (matrix1 and matrix2) element by element using nested loops and LINQ. It iterates through each row of the first matrix and each column of the second matrix, calculating the dot product for each element in the resulting matrix. The result of the multiplication is stored in a flattened one-dimensional array, matrixResult.
52
+
*The public method, PerformIntensiveCalculations, multiplies two matrices (matrix1 and matrix2) element-by-element using nested loops and LINQ. It iterates through each row of the first matrix and each column of the second matrix, calculating the dot product for each element in the resulting matrix. The result of the multiplication is stored in a flattened one-dimensional array, called matrixResult.
51
53
52
54
This code is provided for demonstrating heavy computational operations, such as large matrix manipulations, and can simulate workloads in scenarios that mimic intensive data processing or scientific calculations.
53
55
54
-
Then, open the `Program.cs` file in the `NetAspire.Arm.ApiService` directory and add modify the `MapGet` function of the app as shown:
56
+
Now open the `Program.cs` file in the `NetAspire.Arm.ApiService` directory, and modify the `MapGet` function of the app as shown:
This will trigger matrix multiplications when you click Weather in the webfrontend application.
75
+
This triggers matrix multiplications when you select **Weather** in the web-frontend application.
74
76
75
77
To test the code, re-run the application using the following command:
76
78
77
79
```console
78
80
dotnet run --project NetAspire.Arm.AppHost
79
81
```
80
82
81
-
Next, navigate to the web frontend, click Weather, and then return to the dashboard. Click Traces to observe that the operation now takes significantly longer to complete—approximately 4 seconds in the example below:
83
+
Next, navigate to the web frontend, select **Weather**, and then return to the dashboard. Click **Traces** and note that the operation now takes significantly longer to complete — approximately four seconds in the example below:
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/net-aspire/run_app.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,6 @@ On the dashboard, locate and click the endpoint link for `NetAspire.Arm.Web`. Th
43
43
44
44
Now return to the dashboard, and select the **Traces** option. This section provides detailed telemetry tracing, allowing you to view the flow of requests, track service dependencies, and analyze performance metrics for your application:
By following these steps, you can explore the key components of the .NET Aspire application, including its dashboard, data interaction through APIs, and telemetry tracing capabilities.
0 commit comments