Skip to content

Commit

Permalink
Better memlog-view script--now uses Shiny
Browse files Browse the repository at this point in the history
  • Loading branch information
jcheng5 committed Dec 10, 2013
1 parent 6c841f6 commit 9989ac8
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions tools/memlog-view.R
Expand Up @@ -2,14 +2,21 @@ library(ggplot2)
library(reshape2)
library(shiny)


memlog <- file.choose()
while (TRUE) {
data <- read.csv(memlog)
p <- ggplot(data = data, aes(x = 1:nrow(data)))
p <- p + geom_line(aes(y = rss), color = 'red')
p <- p + geom_line(aes(y = heapTotal))
p <- p + geom_line(aes(y = heapUsed))
print(p)
data <- reactiveFileReader(300, NULL, memlog, read.csv)

Sys.sleep(5)
}
runApp(list(ui = basicPage(
plotOutput("plot")
),
server = function(input, output, session) {
output$plot <- renderPlot({
p <- ggplot(data = data(), aes(x = 1:nrow(data())))
p <- p + geom_line(aes(y = rss), color = 'red')
p <- p + geom_line(aes(y = heapTotal))
p <- p + geom_line(aes(y = heapUsed))
p <- p + geom_smooth(aes(y = rss), method = "loess")
print(p)
})
}
), launch.browser = rstudio::viewer)

0 comments on commit 9989ac8

Please sign in to comment.