Skip to content

Commit

Permalink
Fix Memory tab
Browse files Browse the repository at this point in the history
  • Loading branch information
eloaders committed Jan 21, 2014
1 parent 765ab4d commit 32c53e8
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 60 deletions.
8 changes: 8 additions & 0 deletions getusage.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <glibtop/cpu.h>
#include <glibtop/mem.h>
#include <glibtop/proclist.h>
#include <glibtop/swap.h>
get_cpu(glibtop_cpu *cpustruct) {
glibtop_get_cpu(cpustruct);
return 100 - (float)cpustruct->idle / (float)cpustruct->total * 100;
Expand All @@ -16,6 +17,7 @@ int main() {
glibtop_init();
glibtop_cpu cpu;
glibtop_mem memory;
glibtop_swap swap;
glibtop_proclist proclist;
glibtop_get_cpu (&cpu);
glibtop_get_mem(&memory);
Expand Down Expand Up @@ -60,6 +62,11 @@ int main() {
printf(" \"MEMORY_CACHED\": %ld ,\n", (unsigned long)memory.cached/(1024*1024));
printf(" \"MEMORY_USER\": %ld ,\n", (unsigned long)memory.user/(1024*1024));
printf(" \"MEMORY_LOCKED\": %ld ,\n", (unsigned long)memory.locked/(1024*1024));
printf(" \"SWAP_TOTAL\": %ld ,\n", (unsigned long)swap.total); /* GLIBTOP_SWAP_TOTAL */
printf(" \"SWAP_USED\": %ld ,\n", (unsigned long)swap.used); /* GLIBTOP_SWAP_USED */
printf(" \"SWAP_FREE\": %ld ,\n", (unsigned long)swap.free); /* GLIBTOP_SWAP_FREE */
printf(" \"SWAP_PAGEIN\": %ld ,\n", (unsigned long)swap.pagein); /* GLIBTOP_SWAP_PAGEIN */
printf(" \"SWAP_PAGEOUT\": %ld ,\n", (unsigned long)swap.pageout); /* GLIBTOP_SWAP_PAGEOUT */
printf(" \"UPTIME_DAYS\": %d ,\n", days);
printf(" \"UPTIME_HOURS\": %d ,\n", hours);
printf(" \"UPTIME_MINUTES\": %d ,\n", mins);
Expand Down Expand Up @@ -87,5 +94,6 @@ int main() {
printf("The number of clock ticks per second: %ld\n", sysconf(_SC_CLK_TCK));
printf("The number of processors currently online (available): %ld\n", sysconf(_SC_NPROCESSORS_ONLN));
printf("The number of processors configured: %ld\n", sysconf(_SC_NPROCESSORS_CONF));*/
glibtop_close();
return 0;
}
62 changes: 42 additions & 20 deletions src/i-nex/.src/Finfosys.class
Original file line number Diff line number Diff line change
Expand Up @@ -588,36 +588,58 @@ Public Sub Button1_Click()
End

Public Sub dospam_uptime()
Dim total, used, freee, shared, buffers, cached, usedonthistime, swaptotal As String
Dim dospam, totpam, totalswap, usedswap, Users As String
Dim Users As String
Dim USAGE_BUFFER As String
Dim USAGE As Collection
Shell "users | tr ' ' '\n' | wc -l" Wait To Users
Exec [ChkPrm.ChkExecDir("inex-usage")] Wait To USAGE_BUFFER
USAGE = JSON.Decode(USAGE_BUFFER)
Label85.Text = "Total: " & Int(USAGE["TOTAL_RAM"]) & " MB"
Label86.Text = "Used: " & Int(Int(USAGE["TOTAL_RAM"]) - Int(USAGE["FREE_RAM"])) & " MB"
Label87.Text = "Free: " & Int(USAGE["MEMORY_FREE"]) & " MB"
Label88.Text = "Shared: " & Int(USAGE["SHARED_RAM"]) & " MB"
Label89.Text = "Buffers: " & Int(USAGE["BUFFERED_RAM"]) & " MB"
Label90.Text = "Cached: " & Int(USAGE["MEMORY_CACHED"]) & " MB"
Label223.Text = "Ram used: " & Int(USAGE["MEMORY_USER"]) & " MB"
Label91.Text = "SWAP Total: " & Int(USAGE["TOTAL_SWAP"]) & " MB " ""
TextLabel15.Text = "Physical Memory Used: " & Int(USAGE["PHYS_MEM_USED"]) & " MB " ""
TextLabel24.Text = "SWAP memory used: " & Int(Int(USAGE["TOTAL_SWAP"]) - Int(USAGE["FREE_SWAP"])) & " MB"
TextBox58.Text = "Days: " & USAGE["UPTIME_DAYS"] & " " &
"Hours: " & USAGE["UPTIME_HOURS"] & " " &
"Minutes: " & USAGE["UPTIME_MINUTES"] & " " &
"Seconds: " & USAGE["UPTIME_SECONDS"] & " " &

Label85.Text = "Total: " &
Int(USAGE["TOTAL_RAM"]) &
" MB"
Label86.Text = "Used: " &
Int(Int(USAGE["TOTAL_RAM"]) - Int(USAGE["FREE_RAM"])) &
" MB"
Label87.Text = "Free: " &
Int(USAGE["MEMORY_FREE"]) &
" MB"
Label88.Text = "Shared: " &
Int(USAGE["SHARED_RAM"]) &
" MB"
Label89.Text = "Buffers: " &
Int(USAGE["BUFFERED_RAM"]) &
" MB"
Label90.Text = "Cached: " &
Int(USAGE["MEMORY_CACHED"]) &
" MB"
Label223.Text = "Ram used: " &
Int(USAGE["MEMORY_USER"]) &
" MB"
Label91.Text = "SWAP Total: " &
Int(USAGE["TOTAL_SWAP"]) &
" MB "
TextLabel15.Text = "Physical Memory Used: " &
Int(USAGE["PHYS_MEM_USED"]) &
" MB "
TextLabel24.Text = "SWAP memory used: " &
Int(Int(USAGE["TOTAL_SWAP"]) - Int(USAGE["FREE_SWAP"])) &
" MB"

TextBox58.Text = "Days: " & USAGE["UPTIME_DAYS"] &
" " &
"Hours: " & USAGE["UPTIME_HOURS"] &
" " &
"Minutes: " & USAGE["UPTIME_MINUTES"] &
" " &
"Seconds: " & USAGE["UPTIME_SECONDS"] &
" " &
"Users: " & Subst$(Users) &
"load average: " & Int(USAGE["LOAD_AVG_1MIN"]) & " " &
", " & Int(USAGE["LOAD_AVG_5MIN"]) & " " &
", " & Int(USAGE["LOAD_AVG_15MIN"])

Try ProgressBar6.Value = Int(USAGE["PHYS_MEM_USED"]) / Int(USAGE["TOTAL_VIRTUAL_MEM"])
'Try ProgressBar1.Value = Int(CFloat(dospam)) / Int(CFloat(totpam))
Try ProgressBar7.Value = Int(USAGE["LOAD_AVG_1MIN"]) / Int(100)
Try ProgressBar8.Value = Int(USAGE["LOAD_AVG_5MIN"]) / Int(100)
Try ProgressBar9.Value = Int(USAGE["LOAD_AVG_15MIN"]) / Int(100)
Try ProgressBar1.Value = Int(USAGE["MEMORY_USER"]) / Int(USAGE["MEMORY_TOTAL"])
Try ProgressBar4.Value = Int(Int(USAGE["TOTAL_SWAP"]) - Int(USAGE["FREE_SWAP"])) / Int(USAGE["TOTAL_SWAP"])

Expand Down
49 changes: 9 additions & 40 deletions src/i-nex/.src/Finfosys.form
Original file line number Diff line number Diff line change
Expand Up @@ -1584,17 +1584,17 @@
Text = ("Memory")
Picture = Picture["AppIcons/Finfosys/utilities-system-monitor.png"]
{ ProgressBar1 ProgressBar
Move(140,308,329,21)
Move(7,252,455,21)
}
{ ProgressBar4 ProgressBar
Move(140,329,329,21)
Move(7,294,455,21)
}
{ TextLabel24 TextLabel
Move(0,329,140,21)
Move(7,273,455,21)
Font = Font["Bold,8"]
Padding = 1
Text = ("N/A")
Alignment = Align.Left
Alignment = Align.Center
Border = Border.Raised
}
{ Separator5 Separator
Expand All @@ -1617,7 +1617,7 @@
Picture = Picture["AppIcons/gtk-yes.png"]
}
{ ProgressBar6 ProgressBar
Move(140,350,329,21)
Move(7,336,455,21)
}
{ Label85 Label
Move(0,371,189,21)
Expand Down Expand Up @@ -1669,51 +1669,20 @@
Padding = 3
Border = Border.Raised
}
{ ProgressBar7 ProgressBar
Move(112,245,357,21)
Label = False
}
{ ProgressBar8 ProgressBar
Move(112,266,357,21)
Label = False
}
{ ProgressBar9 ProgressBar
Move(112,287,357,21)
Label = False
}
{ Label220 Label
Move(0,245,112,21)
Font = Font["Bold,8"]
Padding = 3
Text = ("LOAD_AVG_1MIN")
Border = Border.Raised
}
{ Label221 Label
Move(0,266,112,21)
Font = Font["Bold,8"]
Padding = 3
Text = ("LOAD_AVG_5MIN")
Border = Border.Raised
}
{ Label222 Label
Move(0,287,112,21)
Font = Font["Bold,8"]
Text = ("LOAD_AVG_15MIN")
Border = Border.Raised
}
{ Label223 Label
Move(0,308,140,21)
Move(7,231,455,21)
Font = Font["Bold,8"]
Padding = 3
Text = ("Label223")
Alignment = Align.Center
Border = Border.Raised
}
{ TextLabel15 TextLabel
Move(0,350,140,21)
Move(7,315,455,21)
Font = Font["Bold,8"]
Padding = 1
Text = ("TextLabel15")
Alignment = Align.Left
Alignment = Align.Center
Border = Border.Raised
}
Index = 8
Expand Down

0 comments on commit 32c53e8

Please sign in to comment.