From 086d5dfeff55cbb43acebbceb2e3d75253b0c4ef Mon Sep 17 00:00:00 2001
From: Chris Coley <chris@codingallnight.com>
Date: Thu, 27 Dec 2018 13:49:36 -0800
Subject: [PATCH] Add a function to perform web request diagnostics with cURL

---
 bash_aliases | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/bash_aliases b/bash_aliases
index 3faeded..7951987 100644
--- a/bash_aliases
+++ b/bash_aliases
@@ -61,6 +61,20 @@ alias swp='find . -type f -name ".*.sw?"'
 #    Functions    #
 ###################
 
+# Basic benchmark with cURL
+alias _curl_time='echo "curl_time(): Show timing info for a cURL request"'
+function curl_time {
+    curl -s -o /dev/null -w "\
+   namelookup:  %{time_namelookup}s\n\
+      connect:  %{time_connect}s\n\
+   appconnect:  %{time_appconnect}s\n\
+  pretransfer:  %{time_pretransfer}s\n\
+     redirect:  %{time_redirect}s\n\
+starttransfer:  %{time_starttransfer}s\n\
+----------------------\n\
+        total:  %{time_total}s\n" "$@"
+}
+
 # Count the number of files in a directory and its sub-directories
 alias _count='echo "count(): Count the number of files in a directory and its sub-directories"'
 function count {
-- 
GitLab