lib/connections: Add KCP support (fixes #804)

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3489
This commit is contained in:
Audrius Butkevicius
2017-03-07 12:44:16 +00:00
committed by Jakob Borg
parent 151004d645
commit 0da0774ce4
181 changed files with 30946 additions and 106 deletions

28
test/usage_windows.go Normal file
View File

@@ -0,0 +1,28 @@
// Copyright (C) 2014 The Syncthing Authors.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at http://mozilla.org/MPL/2.0/.
// +build integration,benchmark,windows
package integration
import (
"log"
"os"
"syscall"
"time"
)
func ftToDuration(ft *syscall.Filetime) time.Duration {
n := int64(ft.HighDateTime)<<32 + int64(ft.LowDateTime) // in 100-nanosecond intervals
return time.Duration(n*100) * time.Nanosecond
}
func printUsage(name string, proc *os.ProcessState) {
if rusage, ok := proc.SysUsage().(*syscall.Rusage); ok {
log.Printf("%s: Utime: %s", name, ftToDuration(&rusage.UserTime))
log.Printf("%s: Stime: %s", name, ftToDuration(&rusage.KernelTime))
}
}