Skip to content

Commit

Permalink
Improve timing
Browse files Browse the repository at this point in the history
  • Loading branch information
gagliardetto committed Sep 6, 2023
1 parent c2bf5a2 commit 9d0ec82
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion http-range.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ type readCloserWrapper struct {
func (r *readCloserWrapper) ReadAt(p []byte, off int64) (n int, err error) {
startedAt := time.Now()
defer func() {
took := time.Since(startedAt)
if DebugMode {
var icon string
if r.isRemote {
Expand All @@ -203,7 +204,7 @@ func (r *readCloserWrapper) ReadAt(p []byte, off int64) (n int, err error) {
if strings.HasSuffix(r.name, ".car") {
prefix = icon + purpleBG("[READ-CAR]")
}
fmt.Fprintf(os.Stderr, prefix+" %s:%d+%d (%s)\n", filepath.Base(r.name), off, len(p), time.Since(startedAt))
fmt.Fprintf(os.Stderr, prefix+" %s:%d+%d (%s)\n", filepath.Base(r.name), off, len(p), took)
}
}()
return r.rac.ReadAt(p, off)
Expand Down

0 comments on commit 9d0ec82

Please sign in to comment.