uvm_stat.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* $OpenBSD: uvm_stat.c,v 1.28 2014/10/25 12:54:16 miod Exp $ */
  2. /* $NetBSD: uvm_stat.c,v 1.18 2001/03/09 01:02:13 chs Exp $ */
  3. /*
  4. * Copyright (c) 1997 Charles D. Cranor and Washington University.
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  17. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  18. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  19. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  20. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  21. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  22. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  23. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  25. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. *
  27. * from: Id: uvm_stat.c,v 1.1.2.3 1997/12/19 15:01:00 mrg Exp
  28. */
  29. /*
  30. * uvm_stat.c
  31. */
  32. #include <sys/param.h>
  33. #include <sys/systm.h>
  34. #include <uvm/uvm.h>
  35. #include <uvm/uvm_ddb.h>
  36. #ifdef DDB
  37. /*
  38. * uvmexp_print: ddb hook to print interesting uvm counters
  39. */
  40. void
  41. uvmexp_print(int (*pr)(const char *, ...))
  42. {
  43. (*pr)("Current UVM status:\n");
  44. (*pr)(" pagesize=%d (0x%x), pagemask=0x%x, pageshift=%d\n",
  45. uvmexp.pagesize, uvmexp.pagesize, uvmexp.pagemask,
  46. uvmexp.pageshift);
  47. (*pr)(" %d VM pages: %d active, %d inactive, %d wired, %d free (%d zero)\n",
  48. uvmexp.npages, uvmexp.active, uvmexp.inactive, uvmexp.wired,
  49. uvmexp.free, uvmexp.zeropages);
  50. (*pr)(" min %d%% (%d) anon, %d%% (%d) vnode, %d%% (%d) vtext\n",
  51. uvmexp.anonminpct, uvmexp.anonmin, uvmexp.vnodeminpct,
  52. uvmexp.vnodemin, uvmexp.vtextminpct, uvmexp.vtextmin);
  53. (*pr)(" pages %d anon, %d vnode, %d vtext\n",
  54. uvmexp.anonpages, uvmexp.vnodepages, uvmexp.vtextpages);
  55. (*pr)(" freemin=%d, free-target=%d, inactive-target=%d, "
  56. "wired-max=%d\n", uvmexp.freemin, uvmexp.freetarg, uvmexp.inactarg,
  57. uvmexp.wiredmax);
  58. (*pr)(" faults=%d, traps=%d, intrs=%d, ctxswitch=%d fpuswitch=%d\n",
  59. uvmexp.faults, uvmexp.traps, uvmexp.intrs, uvmexp.swtch,
  60. uvmexp.fpswtch);
  61. (*pr)(" softint=%d, syscalls=%d, kmapent=%d\n",
  62. uvmexp.softs, uvmexp.syscalls, uvmexp.kmapent);
  63. (*pr)(" fault counts:\n");
  64. (*pr)(" noram=%d, noanon=%d, pgwait=%d, pgrele=%d\n",
  65. uvmexp.fltnoram, uvmexp.fltnoanon, uvmexp.fltpgwait,
  66. uvmexp.fltpgrele);
  67. (*pr)(" ok relocks(total)=%d(%d), anget(retries)=%d(%d), "
  68. "amapcopy=%d\n", uvmexp.fltrelckok, uvmexp.fltrelck,
  69. uvmexp.fltanget, uvmexp.fltanretry, uvmexp.fltamcopy);
  70. (*pr)(" neighbor anon/obj pg=%d/%d, gets(lock/unlock)=%d/%d\n",
  71. uvmexp.fltnamap, uvmexp.fltnomap, uvmexp.fltlget, uvmexp.fltget);
  72. (*pr)(" cases: anon=%d, anoncow=%d, obj=%d, prcopy=%d, przero=%d\n",
  73. uvmexp.flt_anon, uvmexp.flt_acow, uvmexp.flt_obj, uvmexp.flt_prcopy,
  74. uvmexp.flt_przero);
  75. (*pr)(" daemon and swap counts:\n");
  76. (*pr)(" woke=%d, revs=%d, scans=%d, obscans=%d, anscans=%d\n",
  77. uvmexp.pdwoke, uvmexp.pdrevs, uvmexp.pdscans, uvmexp.pdobscan,
  78. uvmexp.pdanscan);
  79. (*pr)(" busy=%d, freed=%d, reactivate=%d, deactivate=%d\n",
  80. uvmexp.pdbusy, uvmexp.pdfreed, uvmexp.pdreact, uvmexp.pddeact);
  81. (*pr)(" pageouts=%d, pending=%d, nswget=%d\n", uvmexp.pdpageouts,
  82. uvmexp.pdpending, uvmexp.nswget);
  83. (*pr)(" nswapdev=%d, nanon=%d, nanonneeded=%d nfreeanon=%d\n",
  84. uvmexp.nswapdev, uvmexp.nanon, uvmexp.nanonneeded,
  85. uvmexp.nfreeanon);
  86. (*pr)(" swpages=%d, swpginuse=%d, swpgonly=%d paging=%d\n",
  87. uvmexp.swpages, uvmexp.swpginuse, uvmexp.swpgonly, uvmexp.paging);
  88. (*pr)(" kernel pointers:\n");
  89. (*pr)(" objs(kern)=%p\n", uvm.kernel_object);
  90. }
  91. #endif