2017-12-04 14:33 GMT+01:00 Cecil Westerhof <[email protected]>:
>
>
> 2017-11-19 23:00 GMT+01:00 jungle boogie <[email protected]>:
>
>> Thus said Cecil Westerhof on Sat, 18 Nov 2017 14:43:23 +0100
>>
>>> I found the benefits for TCL/TK. But this is a SQLite mailing list, so
>>> not
>>> the right place to ask questions if it is not connected to SQLite also.
>>> What would be good resources for TCL/TK?
>>>
>>>
>> There's also a pretty active IRC room on freenode, it's #tcl.
>>
>> Let us know how your experiences go with tcl.
>
>
I also made a script to store the values from vmstat:
#!/usr/bin/env tclsh
### Improvements
# Get database from conf-file
package require sqlite3
if {$argc != 1} {
error "Error: ${argv0} DATABASE"
}
sqlite db [lindex $argv 0]
db timeout 10000
set insertVmstat "
INSERT INTO vmstat (
runlength,
-- procs
runable, uninteruptable,
-- memory
swap, free, buffers, cache,
-- swap
swapIn, swapOut,
-- io
blockIn, blockOut,
-- system
interuptsPerSec, contextSwitchesPerSec,
-- cpu
userTime, systemTime, idleTime, waitTime,
stolenTime
) VALUES (
:runLength,
:runable, :uninteruptable,
:swap, :free, :buffers, :cache,
:swapIn, :swapOut,
:blockIn, :blockOut,
:interuptsPerSec, :contextSwitchesPerSec,
:userTime, :systemTime, :idleTime, :waitTime, :stolenTime
);
"
set runLength 60
puts "Using an interval of ${runLength} seconds"
after [expr {1000 * (60 - [clock seconds] % 60)}]
set vmstat [open "|vmstat -n ${runLength}"]
# The first three lines need to be skipped
for {set i 0} {${i} < 3} {incr i} {
gets ${vmstat}
}
while {true} {
lassign [gets ${vmstat}] \
runable uninteruptable \
swap free buffers cache \
swapIn swapOut \
blockIn blockOut \
interuptsPerSec contextSwitchesPerSec \
userTime systemTime idleTime waitTime stolenTime
db eval ${insertVmstat}
}
# Not really necessary because the above loop never ends
# But I find this more clear and is robuster against change
close vmstat
db close
--
Cecil Westerhof
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users