mirror of
				https://github.com/mickael-kerjean/filestash.git
				synced 2025-10-31 01:58:11 +08:00 
			
		
		
		
	fix (plugin): extend API for plugins
This commit is contained in:
		
							
								
								
									
										21
									
								
								server/common/debug.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								server/common/debug.go
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,21 @@ | ||||
| package common | ||||
|  | ||||
| import ( | ||||
| 	"runtime" | ||||
| 	"fmt" | ||||
| ) | ||||
|  | ||||
| func PrintMemUsage() { | ||||
| 	var m runtime.MemStats | ||||
| 	runtime.ReadMemStats(&m) | ||||
| 	// For info on each, see: https://golang.org/pkg/runtime/#MemStats | ||||
| 	fmt.Printf("Alloc = %v MiB", bToMb(m.Alloc)) | ||||
| 	fmt.Printf("\tTotalAlloc = %v MiB", bToMb(m.TotalAlloc)) | ||||
| 	fmt.Printf("\tSys = %v MiB", bToMb(m.Sys)) | ||||
| 	fmt.Printf("\tObjects = %d", m.HeapObjects) | ||||
| 	fmt.Printf("\tNumGC = %v\n", m.NumGC) | ||||
| } | ||||
|  | ||||
| func bToMb(b uint64) uint64 { | ||||
|     return b / 1024 / 1024 | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Mickael KERJEAN
					Mickael KERJEAN