Skip to content

Commit

Permalink
clean up example
Browse files Browse the repository at this point in the history
  • Loading branch information
briangu committed Jan 25, 2024
1 parent 62345a1 commit 32f04b4
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions examples/stats_logging/stats_server.kg
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,12 @@ statsT:::[:_(tbs?"stats");.table(colsFromNames(cols));tbs?"stats"]
:" Create a database so we can inspect the data "
db::.db(:{},"stats",,statsT)

:" Reading from the db will cause buffered inserts to flush into the underlying table "
syncDb::{db("select 1 from stats")}

:" Read and print the table size "
tableSize::{[q];q::db("select count(*) from stats");.d("rows: ");.p(q);q}
tableSize()

:" Periodically report write stats "
lastTime::.pc()
lastSize::0
batchSize::0
lastTime::.pc();lastSize::0;batchSize::0
writeStats::{[n];n::.pc();.d("writes/sec: ");.p((batchSize-lastSize)%(n-lastTime));lastTime::n;lastSize::batchSize;1}
.timer("write stats";60;writeStats)

Expand Down

0 comments on commit 32f04b4

Please sign in to comment.