From 158a45e4dcec1739be013537f2d15b15c6c3d269 Mon Sep 17 00:00:00 2001 From: gmallard Date: Wed, 27 Jul 2016 13:22:15 -0400 Subject: [PATCH] Belatedly add elapsed time calculation and display. --- ack/ack.go | 8 ++++++++ conndisc_tls/conndisc_tls.go | 10 ++++++++++ tlsexamps/tlsuc1/tlsuc1.go | 10 ++++++++++ tlsexamps/tlsuc2/tlsuc2.go | 10 ++++++++++ tlsexamps/tlsuc3/tlsuc3.go | 10 ++++++++++ tlsexamps/tlsuc4/tlsuc4.go | 11 ++++++++++- version.go | 2 +- 7 files changed, 59 insertions(+), 2 deletions(-) diff --git a/ack/ack.go b/ack/ack.go index 43df9f7..805e452 100644 --- a/ack/ack.go +++ b/ack/ack.go @@ -47,6 +47,7 @@ import ( "github.com/gmallard/stompngo" "log" "os" + "time" // senv methods could be used in general by stompngo clients. "github.com/gmallard/stompngo/senv" // sngecomm methods are used specifically for these example clients. @@ -62,6 +63,8 @@ var ( // Connect to a STOMP broker, receive some messages, ACK them, and disconnect. func main() { + st := time.Now() + // Standard example connect sequence n, conn, e := sngecomm.CommonConnect(exampid, tag, ll) if e != nil { @@ -152,4 +155,9 @@ func main() { exampid, tag, conn.Session(), e.Error()) // Handle this ...... } + + ll.Printf("%stag:%s connsess:%s main_elapsed:%v\n", + exampid, tag, conn.Session(), + time.Now().Sub(st)) + } diff --git a/conndisc_tls/conndisc_tls.go b/conndisc_tls/conndisc_tls.go index 9b2e047..16e5eee 100644 --- a/conndisc_tls/conndisc_tls.go +++ b/conndisc_tls/conndisc_tls.go @@ -32,6 +32,7 @@ import ( "crypto/tls" "log" "os" + "time" // sngecomm methods are used specifically for these example clients. "github.com/gmallard/stompngo_examples/sngecomm" ) @@ -46,6 +47,11 @@ var ( // Connect to a STOMP broker using TLS and disconnect. func main() { + st := time.Now() + + ll.Printf("%stag:%s connsess:%s starts\n", + exampid, tag, sngecomm.Lcs) + // TLS Configuration. This configuration assumes that: // a) The server used does *not* require client certificates // b) This client has no need to authenticate the server @@ -76,4 +82,8 @@ func main() { ll.Fatalf("%s %s\n", exampid, e.Error()) // Handle this ...... } + ll.Printf("%stag:%s connsess:%s main_elapsed:%v\n", + exampid, tag, conn.Session(), + time.Now().Sub(st)) + } diff --git a/tlsexamps/tlsuc1/tlsuc1.go b/tlsexamps/tlsuc1/tlsuc1.go index c48535a..4ecfc94 100644 --- a/tlsexamps/tlsuc1/tlsuc1.go +++ b/tlsexamps/tlsuc1/tlsuc1.go @@ -39,6 +39,7 @@ import ( "crypto/tls" "log" "os" + "time" // sngecomm methods are used specifically for these example clients. "github.com/gmallard/stompngo_examples/sngecomm" ) @@ -55,6 +56,11 @@ var ( // Connect to a STOMP broker using TLS and disconnect. func main() { + st := time.Now() + + ll.Printf("%stag:%s connsess:%s starts\n", + exampid, tag, sngecomm.Lcs) + // TLS Configuration. tc = new(tls.Config) tc.InsecureSkipVerify = true // Do *not* check the server's certificate @@ -80,4 +86,8 @@ func main() { ll.Fatalf("%s %s\n", exampid, e.Error()) // Handle this ...... } + ll.Printf("%stag:%s connsess:%s main_elapsed:%v\n", + exampid, tag, conn.Session(), + time.Now().Sub(st)) + } diff --git a/tlsexamps/tlsuc2/tlsuc2.go b/tlsexamps/tlsuc2/tlsuc2.go index e5d3f55..f19e88b 100644 --- a/tlsexamps/tlsuc2/tlsuc2.go +++ b/tlsexamps/tlsuc2/tlsuc2.go @@ -44,6 +44,7 @@ import ( "io/ioutil" "log" "os" + "time" // "github.com/gmallard/stompngo/senv" // sngecomm methods are used specifically for these example clients. @@ -67,6 +68,11 @@ func init() { // Connect to a STOMP broker using TLS and disconnect. func main() { + st := time.Now() + + ll.Printf("%stag:%s connsess:%s starts\n", + exampid, tag, sngecomm.Lcs) + flag.Parse() // Parse flags ll.Printf("%stag:%s connsess:%s main_using_srvCAFile:%s\n", exampid, tag, sngecomm.Lcs, @@ -121,4 +127,8 @@ func main() { ll.Fatalf("%s %s\n", exampid, e.Error()) // Handle this ...... } + ll.Printf("%stag:%s connsess:%s main_elapsed:%v\n", + exampid, tag, conn.Session(), + time.Now().Sub(st)) + } diff --git a/tlsexamps/tlsuc3/tlsuc3.go b/tlsexamps/tlsuc3/tlsuc3.go index 0fe4cb9..5dffed5 100644 --- a/tlsexamps/tlsuc3/tlsuc3.go +++ b/tlsexamps/tlsuc3/tlsuc3.go @@ -40,6 +40,7 @@ import ( "flag" "log" "os" + "time" // senv methods could be used in general by stompngo clients. "github.com/gmallard/stompngo/senv" // sngecomm methods are used specifically for these example clients. @@ -64,6 +65,11 @@ func init() { // Connect to a STOMP broker using TLS and disconnect. func main() { + st := time.Now() + + ll.Printf("%stag:%s connsess:%s starts\n", + exampid, tag, sngecomm.Lcs) + flag.Parse() // Parse flags ll.Printf("%stag:%s connsess:%s main_using_cliCertFile:%s\n", exampid, tag, sngecomm.Lcs, @@ -111,4 +117,8 @@ func main() { ll.Fatalf("%s %s\n", exampid, e.Error()) // Handle this ...... } + ll.Printf("%stag:%s connsess:%s main_elapsed:%v\n", + exampid, tag, conn.Session(), + time.Now().Sub(st)) + } diff --git a/tlsexamps/tlsuc4/tlsuc4.go b/tlsexamps/tlsuc4/tlsuc4.go index 1ca13e0..a5413c3 100644 --- a/tlsexamps/tlsuc4/tlsuc4.go +++ b/tlsexamps/tlsuc4/tlsuc4.go @@ -43,6 +43,7 @@ import ( "io/ioutil" "log" "os" + "time" // senv methods could be used in general by stompngo clients. "github.com/gmallard/stompngo/senv" // sngecomm methods are used specifically for these example clients. @@ -69,7 +70,11 @@ func init() { // Connect to a STOMP broker using TLS and disconnect. func main() { - ll.Printf("%s starts\n", exampid) + + st := time.Now() + + ll.Printf("%stag:%s connsess:%s starts\n", + exampid, tag, sngecomm.Lcs) flag.Parse() // Parse flags ll.Printf("%stag:%s connsess:%s main_using_srvCAFile:%s\n", @@ -140,4 +145,8 @@ func main() { ll.Fatalf("%s %s\n", exampid, e.Error()) // Handle this ...... } + ll.Printf("%stag:%s connsess:%s main_elapsed:%v\n", + exampid, tag, conn.Session(), + time.Now().Sub(st)) + } diff --git a/version.go b/version.go index b4c3e4e..04a39ae 100644 --- a/version.go +++ b/version.go @@ -35,7 +35,7 @@ var ( //patch = "3" // Patch - patch = "3.plvl.006" // Patch + patch = "3.plvl.007" // Patch ) func Version() string { -- 2.11.4.GIT