File: 0001-disable-windows-support-in-ctr-metric.patch

package info (click to toggle)
containerd 1.5.8~ds1-3
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 16,548 kB
  • sloc: sh: 717; makefile: 395
file content (98 lines) | stat: -rw-r--r-- 4,302 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
From: Shengjing Zhu <zhsj@debian.org>
Date: Wed, 16 Sep 2020 15:15:44 +0800
Subject: disable windows support in ctr metric

---
 cmd/ctr/commands/tasks/metrics.go | 55 ---------------------------------------
 1 file changed, 55 deletions(-)

diff --git a/cmd/ctr/commands/tasks/metrics.go b/cmd/ctr/commands/tasks/metrics.go
index a83e45e..e6a23cd 100644
--- a/cmd/ctr/commands/tasks/metrics.go
+++ b/cmd/ctr/commands/tasks/metrics.go
@@ -25,7 +25,6 @@ import (
 	"os"
 	"text/tabwriter"
 
-	wstats "github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/stats"
 	v1 "github.com/containerd/cgroups/stats/v1"
 	v2 "github.com/containerd/cgroups/v2/stats"
 	"github.com/containerd/containerd/cmd/ctr/commands"
@@ -82,15 +81,12 @@ var metricsCommand = cli.Command{
 		var (
 			data         *v1.Metrics
 			data2        *v2.Metrics
-			windowsStats *wstats.Statistics
 		)
 		switch v := anydata.(type) {
 		case *v1.Metrics:
 			data = v
 		case *v2.Metrics:
 			data2 = v
-		case *wstats.Statistics:
-			windowsStats = v
 		default:
 			return errors.New("cannot convert metric data to cgroups.Metrics or windows.Statistics")
 		}
@@ -104,16 +100,6 @@ var metricsCommand = cli.Command{
 				printCgroupMetricsTable(w, data)
 			} else if data2 != nil {
 				printCgroup2MetricsTable(w, data2)
-			} else {
-				if windowsStats.GetLinux() != nil {
-					printCgroupMetricsTable(w, windowsStats.GetLinux())
-				} else if windowsStats.GetWindows() != nil {
-					printWindowsContainerStatistics(w, windowsStats.GetWindows())
-				}
-				// Print VM stats if its isolated
-				if windowsStats.VM != nil {
-					printWindowsVMStatistics(w, windowsStats.VM)
-				}
 			}
 			return w.Flush()
 		case formatJSON:
@@ -167,44 +153,3 @@ func printCgroup2MetricsTable(w *tabwriter.Writer, data *v2.Metrics) {
 		fmt.Fprintf(w, "memory.swap_limit\t%v\t\n", data.Memory.SwapLimit)
 	}
 }
-
-func printWindowsContainerStatistics(w *tabwriter.Writer, stats *wstats.WindowsContainerStatistics) {
-	fmt.Fprintf(w, "METRIC\tVALUE\t\n")
-	fmt.Fprintf(w, "timestamp\t%s\t\n", stats.Timestamp)
-	fmt.Fprintf(w, "start_time\t%s\t\n", stats.ContainerStartTime)
-	fmt.Fprintf(w, "uptime_ns\t%d\t\n", stats.UptimeNS)
-	if stats.Processor != nil {
-		fmt.Fprintf(w, "cpu.total_runtime_ns\t%d\t\n", stats.Processor.TotalRuntimeNS)
-		fmt.Fprintf(w, "cpu.runtime_user_ns\t%d\t\n", stats.Processor.RuntimeUserNS)
-		fmt.Fprintf(w, "cpu.runtime_kernel_ns\t%d\t\n", stats.Processor.RuntimeKernelNS)
-	}
-	if stats.Memory != nil {
-		fmt.Fprintf(w, "memory.commit_bytes\t%d\t\n", stats.Memory.MemoryUsageCommitBytes)
-		fmt.Fprintf(w, "memory.commit_peak_bytes\t%d\t\n", stats.Memory.MemoryUsageCommitPeakBytes)
-		fmt.Fprintf(w, "memory.private_working_set_bytes\t%d\t\n", stats.Memory.MemoryUsagePrivateWorkingSetBytes)
-	}
-	if stats.Storage != nil {
-		fmt.Fprintf(w, "storage.read_count_normalized\t%d\t\n", stats.Storage.ReadCountNormalized)
-		fmt.Fprintf(w, "storage.read_size_bytes\t%d\t\n", stats.Storage.ReadSizeBytes)
-		fmt.Fprintf(w, "storage.write_count_normalized\t%d\t\n", stats.Storage.WriteCountNormalized)
-		fmt.Fprintf(w, "storage.write_size_bytes\t%d\t\n", stats.Storage.WriteSizeBytes)
-	}
-}
-
-func printWindowsVMStatistics(w *tabwriter.Writer, stats *wstats.VirtualMachineStatistics) {
-	fmt.Fprintf(w, "METRIC\tVALUE\t\n")
-	if stats.Processor != nil {
-		fmt.Fprintf(w, "vm.cpu.total_runtime_ns\t%d\t\n", stats.Processor.TotalRuntimeNS)
-	}
-	if stats.Memory != nil {
-		fmt.Fprintf(w, "vm.memory.working_set_bytes\t%d\t\n", stats.Memory.WorkingSetBytes)
-		fmt.Fprintf(w, "vm.memory.virtual_node_count\t%d\t\n", stats.Memory.VirtualNodeCount)
-		fmt.Fprintf(w, "vm.memory.available\t%d\t\n", stats.Memory.VmMemory.AvailableMemory)
-		fmt.Fprintf(w, "vm.memory.available_buffer\t%d\t\n", stats.Memory.VmMemory.AvailableMemoryBuffer)
-		fmt.Fprintf(w, "vm.memory.reserved\t%d\t\n", stats.Memory.VmMemory.ReservedMemory)
-		fmt.Fprintf(w, "vm.memory.assigned\t%d\t\n", stats.Memory.VmMemory.AssignedMemory)
-		fmt.Fprintf(w, "vm.memory.slp_active\t%t\t\n", stats.Memory.VmMemory.SlpActive)
-		fmt.Fprintf(w, "vm.memory.balancing_enabled\t%t\t\n", stats.Memory.VmMemory.BalancingEnabled)
-		fmt.Fprintf(w, "vm.memory.dm_operation_in_progress\t%t\t\n", stats.Memory.VmMemory.DmOperationInProgress)
-	}
-}