[CmdletBinding()]
Param([switch]$ManageTomcat,
[String]$TomcatHome = "C:\apache-tomcat-9.0.0.M19"
)

#Measure-Command { Invoke-WebRequest -URI http://localhost:8080/sbms/semantics/types/type }  Select-Object TotalSeconds


Function Request($url) {
  #"Sending..." + [System.DateTime]::Now
  $start = [System.DateTime]::Now
  $r = Invoke-WebRequest -URI $url | Select-Object StatusCode, Content
  $end = [System.DateTime]::Now.Subtract($start) #| Select-Object TotalSeconds
  $dur = $end.TotalSeconds
  $dur.ToString() + ";" + $r.StatusCode + ";" + $r.Content + ";" + $url
  
}

if($ManageTomcat) {
  $env:CATALINA_HOME=$TomcatHome
  & C:\apache-tomcat-9.0.0.M19\bin\startup.bat
  Pause

}

"duration;statusCode;reply;request"

Request http://localhost:8080/sbms/semantics/types/type

Request http://localhost:8080/sbms/semantics/types/type

if($ManageTomcat) {
  Pause
  & C:\apache-tomcat-9.0.0.M19\bin\shutdown.bat
}