✨
This commit is contained in:
		| @@ -18,10 +18,10 @@ export default function() { | |||||||
| 	}); | 	}); | ||||||
|  |  | ||||||
| 	async function tick() { | 	async function tick() { | ||||||
| 		const cpu      = await cpuUsage(); | 		const cpu = await cpuUsage(); | ||||||
| 		const freemem  = await freeMem(); | 		const freemem = await freeMem(); | ||||||
| 		const totalmem = await totalMem(); | 		const totalmem = await totalMem(); | ||||||
| 		const disk     = diskusage.checkSync(os.platform() == 'win32' ? 'c:' : '/'); | 		const disk = diskusage.checkSync(os.platform() == 'win32' ? 'c:' : '/'); | ||||||
|  |  | ||||||
| 		const stats = { | 		const stats = { | ||||||
| 			cpu_usage: cpu, | 			cpu_usage: cpu, | ||||||
| @@ -45,33 +45,31 @@ export default function() { | |||||||
|  |  | ||||||
| // CPU STAT | // CPU STAT | ||||||
| async function cpuUsage() { | async function cpuUsage() { | ||||||
|   try { | 	try { | ||||||
|     const data = await sysUtils.currentLoad(); | 		const data = await sysUtils.currentLoad(); | ||||||
|     return Math.floor(data.currentload); | 		return Math.floor(data.currentload); | ||||||
|   } | 	} catch (error) { | ||||||
|   catch(error) { | 		console.error(error); | ||||||
|     console.error(error); | 		throw error; | ||||||
|   } | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| // MEMORY(excl buffer + cache) STAT  | // MEMORY(excl buffer + cache) STAT | ||||||
| async function freeMem() { | async function freeMem() { | ||||||
|   try { | 	try { | ||||||
|     const data = await sysUtils.mem(); | 		const data = await sysUtils.mem(); | ||||||
|     return data.active; | 		return data.active; | ||||||
|   } | 	} catch (error) { | ||||||
|   catch(error) { | 		console.error(error); | ||||||
|     console.error(error); | 	} | ||||||
|   } |  | ||||||
| } | } | ||||||
|  |  | ||||||
| // TOTAL MEMORY STAT | // TOTAL MEMORY STAT | ||||||
| async function totalMem() { | async function totalMem() { | ||||||
|   try { | 	try { | ||||||
|     const data = await sysUtils.mem(); | 		const data = await sysUtils.mem(); | ||||||
|     return data.total; | 		return data.total; | ||||||
|   } | 	} catch (error) { | ||||||
|   catch(error) { | 		console.error(error); | ||||||
|     console.error(error); | 	} | ||||||
|   } | } | ||||||
| } |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Aya Morisawa
					Aya Morisawa