pull/1417/head
shirou 2 years ago
parent 6a5e40a517
commit 852f455217

@ -6,8 +6,8 @@ package cpu
import ( import (
"context" "context"
"regexp" "regexp"
"strings"
"strconv" "strconv"
"strings"
"github.com/shirou/gopsutil/v3/internal/common" "github.com/shirou/gopsutil/v3/internal/common"
) )

@ -8,8 +8,8 @@ import (
"regexp" "regexp"
"strings" "strings"
"golang.org/x/sys/unix"
"github.com/shirou/gopsutil/v3/internal/common" "github.com/shirou/gopsutil/v3/internal/common"
"golang.org/x/sys/unix"
) )
var whiteSpaces = regexp.MustCompile(`\s+`) var whiteSpaces = regexp.MustCompile(`\s+`)

@ -12,9 +12,8 @@ import (
"strconv" "strconv"
"strings" "strings"
"golang.org/x/sys/unix"
"github.com/shirou/gopsutil/v3/internal/common" "github.com/shirou/gopsutil/v3/internal/common"
"golang.org/x/sys/unix"
) )
// PartitionsWithContext returns disk partition. // PartitionsWithContext returns disk partition.

@ -21,6 +21,7 @@ package common
// high-performance serialization, especially for large data structures, // high-performance serialization, especially for large data structures,
// should look at more advanced solutions such as the encoding/gob // should look at more advanced solutions such as the encoding/gob
// package or protocol buffers. // package or protocol buffers.
import ( import (
"errors" "errors"
"io" "io"

@ -6,6 +6,7 @@ package common
// - linux (amd64, arm) // - linux (amd64, arm)
// - freebsd (amd64) // - freebsd (amd64)
// - windows (amd64) // - windows (amd64)
import ( import (
"bufio" "bufio"
"bytes" "bytes"

@ -218,8 +218,11 @@ func WMIQueryWithContext(ctx context.Context, query string, dst interface{}, con
} }
// Convert paths using native DOS format like: // Convert paths using native DOS format like:
//
// "\Device\HarddiskVolume1\Windows\systemew\file.txt" // "\Device\HarddiskVolume1\Windows\systemew\file.txt"
//
// into: // into:
//
// "C:\Windows\systemew\file.txt" // "C:\Windows\systemew\file.txt"
func ConvertDOSPath(p string) string { func ConvertDOSPath(p string) string {
rawDrive := strings.Join(strings.Split(p, `\`)[:3], `\`) rawDrive := strings.Join(strings.Split(p, `\`)[:3], `\`)

@ -8,9 +8,8 @@ import (
"errors" "errors"
"unsafe" "unsafe"
"golang.org/x/sys/unix"
"github.com/shirou/gopsutil/v3/internal/common" "github.com/shirou/gopsutil/v3/internal/common"
"golang.org/x/sys/unix"
) )
func VirtualMemory() (*VirtualMemoryStat, error) { func VirtualMemory() (*VirtualMemoryStat, error) {

@ -9,6 +9,7 @@ import (
"encoding/binary" "encoding/binary"
"errors" "errors"
"fmt" "fmt"
"github.com/shirou/gopsutil/v3/internal/common" "github.com/shirou/gopsutil/v3/internal/common"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
) )

@ -211,6 +211,7 @@ func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename stri
// Return a list of network connections // Return a list of network connections
// Available kind: // Available kind:
//
// reference to netConnectionKindMap // reference to netConnectionKindMap
func Connections(kind string) ([]ConnectionStat, error) { func Connections(kind string) ([]ConnectionStat, error) {
return ConnectionsWithContext(context.Background(), kind) return ConnectionsWithContext(context.Background(), kind)

@ -8,9 +8,8 @@ import (
"syscall" "syscall"
"unsafe" "unsafe"
"golang.org/x/sys/windows"
"github.com/shirou/gopsutil/v3/internal/common" "github.com/shirou/gopsutil/v3/internal/common"
"golang.org/x/sys/windows"
) )
type PROCESS_MEMORY_COUNTERS struct { type PROCESS_MEMORY_COUNTERS struct {

Loading…
Cancel
Save