... | ... |
@@ -203,6 +203,12 @@ func (srv *Server) CmdInfo(stdin io.ReadCloser, stdout io.Writer, args ...string |
203 | 203 |
len(srv.runtime.List()), |
204 | 204 |
VERSION, |
205 | 205 |
imgcount) |
206 |
+ |
|
207 |
+ if !rcli.DEBUG_FLAG { |
|
208 |
+ return nil |
|
209 |
+ } |
|
210 |
+ fmt.Fprintf(stdout, "debug mode enabled\n") |
|
211 |
+ fmt.Fprintf(stdout, "fds: %d\ngoroutines: %d\n", getTotalUsedFds(), runtime.NumGoroutine()) |
|
206 | 212 |
return nil |
207 | 213 |
} |
208 | 214 |
|
... | ... |
@@ -7,6 +7,7 @@ import ( |
7 | 7 |
"fmt" |
8 | 8 |
"github.com/dotcloud/docker/rcli" |
9 | 9 |
"io" |
10 |
+ "io/ioutil" |
|
10 | 11 |
"net/http" |
11 | 12 |
"os" |
12 | 13 |
"os/exec" |
... | ... |
@@ -260,3 +261,12 @@ func (w *writeBroadcaster) Close() error { |
260 | 260 |
func newWriteBroadcaster() *writeBroadcaster { |
261 | 261 |
return &writeBroadcaster{list.New()} |
262 | 262 |
} |
263 |
+ |
|
264 |
+func getTotalUsedFds() int { |
|
265 |
+ if fds, err := ioutil.ReadDir(fmt.Sprintf("/proc/%d/fd", os.Getpid())); err != nil { |
|
266 |
+ Debugf("Error opening /proc/%d/fd: %s", os.Getpid(), err) |
|
267 |
+ } else { |
|
268 |
+ return len(fds) |
|
269 |
+ } |
|
270 |
+ return -1 |
|
271 |
+} |