distrib.r 769 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. t<-read.table("output.update_block");
  2. plot.multi.dens <- function(s)
  3. {
  4. junk.x = NULL
  5. junk.y = NULL
  6. for(i in 1:length(s))
  7. {
  8. junk.x = c(junk.x, density(s[[i]])$x)
  9. junk.y = c(junk.y, density(s[[i]])$y)
  10. }
  11. xr <- range(junk.x)
  12. yr <- range(junk.y)
  13. plot(density(s[[1]]), xlim = xr, ylim = yr, main="")
  14. for(i in 1:length(s))
  15. {
  16. lines(density(s[[i]]), xlim = xr, ylim = yr, col = i)
  17. }
  18. }
  19. cpus <- seq(1, 8);
  20. per_cpu <- function(cpuid)
  21. {
  22. t[4][t[2] == cpuid];
  23. }
  24. density_cpu <- function(cpuid)
  25. {
  26. density(per_cpu(cpuid))
  27. }
  28. l <- list()
  29. leg <- c()
  30. for (cpu in 1:4)
  31. {
  32. l <- c(l, list(per_cpu(cpu)))
  33. leg <- c(leg, cpu)
  34. }
  35. library(Hmisc)
  36. plot.multi.dens( l);
  37. le <- largest.empty(per_cpu(0), per_cpu(1), 0.1, 0.1)
  38. legend(le,legend=leg, col=(1:8), lwd=2, lty = 1)