diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000000000000000000000000000000000..8a049e062636bf456b8cc3aadbc5b1b2d145656b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "[markdown]": { + "editor.cursorSurroundingLines": 0 + } +} \ No newline at end of file diff --git a/README.md b/README.md index d21c6e33b010dc25d2180fae0763cbb1f721bf53..9cd2149fa37e5e4d427458bc53193d1bc41069ed 100644 --- a/README.md +++ b/README.md @@ -99,16 +99,16 @@ Run the script with the desired options: The script generates a CSV file (`curl_report.csv`) with the following columns: ```csv -timestamp;url;ttfb;total;client;user;network +timestamp;url;ttfb;download;total;client;user;network ``` ### Example csv output: ```csv 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:48;https://mywebsite.com/image.png;0.078;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: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.234;0.315;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 ... ``` diff --git a/sparrow.ps1 b/sparrow.ps1 index b9ae3c07a0cddada80506536ee46ea7f1a112363..a5e38d9cd62aaa25846908186d821c0d43646ced 100644 --- a/sparrow.ps1 +++ b/sparrow.ps1 @@ -27,11 +27,12 @@ function Perform-Curl { $outputParts = $curlOutput -split ';' $ttfb = $outputParts[0] $totalTime = $outputParts[1] + $downloadTime = [math]::Round(($totalTime - $ttfb), 3) # 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 @@ -57,7 +58,7 @@ $cssUrl = "$u/$cssUrl" $pngUrl = "$u/$pngUrl" # 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 for ($i = 1; $i -le $r; $i++) { diff --git a/sparrow.sh b/sparrow.sh index 26d565d9fda19a875f0bb794c8000877310af92a..2bfce1653476b358b9093db83dbc2d90b73c4bba 100755 --- a/sparrow.sh +++ b/sparrow.sh @@ -32,11 +32,12 @@ perform_curl() { ttfb=$(echo "$curl_output" | cut -d ';' -f 1) total_time=$(echo "$curl_output" | cut -d ';' -f 2) - + download_time=$(awk "BEGIN {print $total_time - $ttfb}") + # 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 @@ -66,7 +67,7 @@ css_url="${base_url}/$css_url" png_url="${base_url}/$png_url" # 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 for ((i=1; i<=repetitions; i++))