added one more status fields (included in the readinAny-field):

Config_readinNetworkLoad (and the according functions)
This commit is contained in:
joten 2012-06-11 01:21:47 +02:00
parent 582ea2b84e
commit 421b18f779
2 changed files with 63 additions and 4 deletions

View file

@ -169,6 +169,7 @@ Bar_init(m) {
}
Bar_hDrive := DllCall("CreateFile", "Str", "\\.\PhysicalDrive0", "UInt", 0, "UInt", 3, "UInt", 0, "UInt", 3, "UInt", 0, "UInt", 0)
Bar_getNetworkInterface()
}
Bar_initCmdGui() {
@ -397,6 +398,7 @@ Bar_getDiskLoad(ByRef readLoad, ByRef writeLoad) {
oldWriteCount := newWriteCount
}
; fures: System + Network monitor - with net history graph (http://www.autohotkey.com/community/viewtopic.php?p=260329)
; SKAN: HDD Activity Monitoring LED (http://www.autohotkey.com/community/viewtopic.php?p=113890&sid=64d9824fdf252697ff4d5026faba91f8#p113890)
Bar_getHeight() {
Global Bar_#0_#1, Bar_#0_#1H, Bar_#0_#2, Bar_#0_#2H, Bar_ctrlHeight, Bar_height, Bar_textHeight
@ -439,6 +441,56 @@ Bar_getMemoryUsage() {
}
; fures: System + Network monitor - with net history graph (http://www.autohotkey.com/community/viewtopic.php?p=260329)
Bar_getNetworkInterface() {
Global Bar_networkInterface, Bar_networkInterfaceTable
DllCall("iphlpapi\GetNumberOfInterfaces", "UIntP", n)
nSize := 4 + 860 * n + 8
VarSetCapacity(Bar_networkInterfaceTable, nSize)
If Not DllCall("iphlpapi\GetIfTable", "UInt", &Bar_networkInterfaceTable, "UIntP", nSize, "Int", False) {
Loop, 2 {
i := 0
j := A_Index
Loop, % NumGet(Bar_networkInterfaceTable) {
If NumGet(Bar_networkInterfaceTable, 4 + 860 * (A_Index - 1) + 544) < 4
|| NumGet(Bar_networkInterfaceTable, 4 + 860 * (A_Index - 1) + 516) = 24
Continue
i += 1
dn_#%i%_#%j% := NumGet(Bar_networkInterfaceTable, 4 + 860 * (A_Index - 1) + 552)
up_#%i%_#%j% := NumGet(Bar_networkInterfaceTable, 4 + 860 * (A_Index - 1) + 576)
}
If (A_Index < 2)
RunWait, %Comspec% /c ping -n 1 127.0.0.1, , hide
}
Loop, % i
If (dn_#%i%_#2 > dn_#%i%_1) {
Bar_networkInterface := i
Break
}
}
}
; fures: System + Network monitor - with net history graph (http://www.autohotkey.com/community/viewtopic.php?p=260329)
Bar_getNetworkLoad(ByRef upLoad, ByRef dnLoad) {
Global Bar_networkInterface, Bar_networkInterfaceTable
Static dn_#0, t_#0, up_#0
DllCall("iphlpapi\GetIfEntry", "UInt", &Bar_networkInterfaceTable + 4 + 860 * (Bar_networkInterface - 1))
dn_#1 := NumGet(Bar_networkInterfaceTable, 4 + 860 * (Bar_networkInterface - 1) + 552) ; Total Incoming Bytes
up_#1 := NumGet(Bar_networkInterfaceTable, 4 + 860 * (Bar_networkInterface - 1) + 576) ; Total Outgoing Bytes
tDiff := (A_TickCount - t_#0) / 1000
t_#0 := A_TickCount
dnLoad := SubStr(" " Round((dn_#1 - dn_#0) / 1024 / tDiff), -3)
upLoad := SubStr(" " Round((up_#1 - up_#0) / 1024 / tDiff), -3)
dn_#0 := dn_#1
up_#0 := up_#1
}
; fures: System + Network monitor - with net history graph (http://www.autohotkey.com/community/viewtopic.php?p=260329)
; Sean: Network Download/Upload Meter (http://www.autohotkey.com/community/viewtopic.php?t=18033)
Bar_getSystemTimes() { ; Total CPU Load
Static oldIdleTime, oldKrnlTime, oldUserTime
Static newIdleTime, newKrnlTime, newUserTime

View file

@ -37,8 +37,9 @@ Config_init() {
Config_readinBat := False ; If true, the system battery status is read in and displayed in the status bar. This only makes sense, if you have a system battery (notebook).
Config_readinCpu := False ; If true, the current CPU load is read in and displayed in the status bar.
Config_readinDate := True ; If true, the current date is read in (format: "WW, DD. MMM. YYYY") and displayed in the status bar.
Config_readinDiskLoad := False ; If true, the current disk usage (read and write) is read in and displayed in the status bar.
Config_readinMemoryUsage := False ; If true, the system memory status is read in and displayed in the status bar.
Config_readinDiskLoad := False ; If true, the current disk load (read and write) is read in and displayed in the status bar.
Config_readinMemoryUsage := False ; If true, the system memory usage is read in and displayed in the status bar.
Config_readinNetworkLoad := False ; If true, the current network load (up and down) is read in and displayed in the status bar.
Config_readinTime := True ; If true, the current time is read in (format: "HH:MM") and displayed in the status bar.
Config_readinInterval := 30000 ; Time in milliseconds after which the above status values are refreshed.
@ -204,7 +205,7 @@ Config_hotkeyLabel:
Return
Config_readinAny() { ; Add information to the variable "text" in this function to display it in the status bar.
Global Config_readinCpu, Config_readinDate, Config_readinDiskLoad, Config_readinMemoryUsage
Global Config_readinCpu, Config_readinDate, Config_readinDiskLoad, Config_readinMemoryUsage, Config_readinNetworkLoad
text := ""
If Config_readinCpu
@ -220,8 +221,14 @@ Config_readinAny() { ; Add information to the variable "text" in this f
Bar_getDiskLoad(rLoad, wLoad)
text .= " Dr: " rLoad "% | Dw: " wLoad "% "
}
If Config_readinDate {
If Config_readinNetworkLoad {
If (Config_readinCpu Or Config_readinMemoryUsage Or Config_readinDiskLoad)
text .= "|"
Bar_getNetworkLoad(upLoad, dnLoad)
text .= " UP: " upLoad " KB/s | dn: " dnLoad " KB/s "
}
If Config_readinDate {
If (Config_readinCpu Or Config_readinMemoryUsage Or Config_readinDiskLoad Or Config_readinNetworkLoad)
text .= "|"
text .= " " A_DDD ", " A_DD ". " A_MMM ". " A_YYYY " "
}