Created
July 16, 2015 19:56
-
-
Save dustinsmith1024/176280e3b705b0f1088a to your computer and use it in GitHub Desktop.
Our Golang timing with logger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// for our internal time | |
saverTimer := logger.Timer() | |
var totalParseTime time.Duration | |
var totalTime time.Duration | |
for { | |
row, err := csvReader.ReadMap(false) | |
... | |
start := time.Now() | |
parseStart := time.Now() | |
record.TransactionDate, err = date.ParseDate(row["transaction_date"]) | |
if err != nil { | |
return err | |
} | |
parseEnd := time.Now() | |
totalParseTime = totalParseTime + end.Sub(start) | |
... | |
end := time.Now() | |
totalTime = totalTime + end.Sub(start) | |
} | |
fmt.Println("total JSON duration", totalJSONParseTime) | |
fmt.Println("total duration", totalParseTime) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment