Skip to content
Snippets Groups Projects
Commit 6a2613a4 authored by Sigmund, Dominik's avatar Sigmund, Dominik
Browse files

Added Download-Time

parent db7f21f2
Branches
No related tags found
No related merge requests found
{
"[markdown]": {
"editor.cursorSurroundingLines": 0
}
}
\ No newline at end of file
...@@ -99,16 +99,16 @@ Run the script with the desired options: ...@@ -99,16 +99,16 @@ Run the script with the desired options:
The script generates a CSV file (`curl_report.csv`) with the following columns: The script generates a CSV file (`curl_report.csv`) with the following columns:
```csv ```csv
timestamp;url;ttfb;total;client;user;network timestamp;url;ttfb;download;total;client;user;network
``` ```
### Example csv output: ### Example csv output:
```csv ```csv
timestamp;url;ttfb;total;client;user;network timestamp;url;ttfb;total;client;user;network
2024-10-09 15:30:45;https://mywebsite.com/style.css;0.056;0.230;client_xyz;user_jane;WiFi 2024-10-09 15:30:45;https://mywebsite.com/style.css;0.056;0.234:0.230;client_xyz;user_jane;WiFi
2024-10-09 15:30:48;https://mywebsite.com/image.png;0.078;0.315;client_xyz;user_jane;WiFi 2024-10-09 15:30:48;https://mywebsite.com/image.png;0.078;0.234;0.315;client_xyz;user_jane;WiFi
2024-10-09 15:31:45;https://mywebsite.com/style.css;0.058;0.225;client_xyz;user_jane;WiFi 2024-10-09 15:31:45;https://mywebsite.com/style.css;0.058;0.123;0.225;client_xyz;user_jane;WiFi
... ...
``` ```
... ...
......
...@@ -27,11 +27,12 @@ function Perform-Curl { ...@@ -27,11 +27,12 @@ function Perform-Curl {
$outputParts = $curlOutput -split ';' $outputParts = $curlOutput -split ';'
$ttfb = $outputParts[0] $ttfb = $outputParts[0]
$totalTime = $outputParts[1] $totalTime = $outputParts[1]
$downloadTime = [math]::Round(($totalTime - $ttfb), 3)
# Append results to the CSV file # Append results to the CSV file
Add-Content $outputFile "$timestamp;$url;$ttfb;$totalTime;$client;$user;$network" Add-Content $outputFile "$timestamp;$url;$ttfb;$downloadTime;$totalTime;$client;$user;$network"
Write-Host "$fileType - Iteration $iteration: TTFB: $ttfb, Total Time: $totalTime" Write-Host "$fileType - Iteration $iteration: TTFB: $ttfb, DownloadTime: $downloadTime; Total Time: $totalTime"
} }
# Function to get a random sleep duration between MIN and MAX # Function to get a random sleep duration between MIN and MAX
...@@ -57,7 +58,7 @@ $cssUrl = "$u/$cssUrl" ...@@ -57,7 +58,7 @@ $cssUrl = "$u/$cssUrl"
$pngUrl = "$u/$pngUrl" $pngUrl = "$u/$pngUrl"
# Initialize the CSV report with headers # Initialize the CSV report with headers
Add-Content $outputFile "timestamp;url;ttfb;total;client;user;network" Add-Content $outputFile "timestamp;url;ttfb;download;total;client;user;network"
# Loop through the number of repetitions # Loop through the number of repetitions
for ($i = 1; $i -le $r; $i++) { for ($i = 1; $i -le $r; $i++) {
... ...
......
...@@ -32,11 +32,12 @@ perform_curl() { ...@@ -32,11 +32,12 @@ perform_curl() {
ttfb=$(echo "$curl_output" | cut -d ';' -f 1) ttfb=$(echo "$curl_output" | cut -d ';' -f 1)
total_time=$(echo "$curl_output" | cut -d ';' -f 2) total_time=$(echo "$curl_output" | cut -d ';' -f 2)
download_time=$(awk "BEGIN {print $total_time - $ttfb}")
# Append results to the CSV file # Append results to the CSV file
echo "$timestamp;$url;$ttfb;$total_time;$client;$user;$network" >> "$output_file" echo "$timestamp;$url;$ttfb;$download_time;$total_time;$client;$user;$network" >> "$output_file"
echo "$file_type - Iteration $iteration: TTFB: $ttfb, Total Time: $total_time" echo "$file_type - Iteration $iteration: TTFB: $ttfb, DownloadTime: $download_time, Total Time: $total_time"
} }
# Function to get a random sleep duration between MIN and MAX # Function to get a random sleep duration between MIN and MAX
...@@ -66,7 +67,7 @@ css_url="${base_url}/$css_url" ...@@ -66,7 +67,7 @@ css_url="${base_url}/$css_url"
png_url="${base_url}/$png_url" png_url="${base_url}/$png_url"
# Initialize the CSV report with headers # Initialize the CSV report with headers
echo "timestamp;url;ttfb;total;client;user;network" > "$output_file" echo "timestamp;url;ttfb;download;total;client;user;network" > "$output_file"
# Loop through the number of repetitions # Loop through the number of repetitions
for ((i=1; i<=repetitions; i++)) for ((i=1; i<=repetitions; i++))
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment