Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add probes for the IO page operations.

  • Loading branch information...
commit 6a17351275a54f39ef882ffc376916c2c1df945d 1 parent fcbf23e
@pgj authored
View
4 packages/mirage-platform/runtime/kernel/page_stubs.c
@@ -42,6 +42,9 @@ SDT_PROVIDER_DECLARE(mirage);
SDT_PROBE_DEFINE(mirage, kernel, alloc_pages, entry, entry);
SDT_PROBE_ARGTYPE(mirage, kernel, alloc_pages, entry, 0, "size_t");
SDT_PROBE_DEFINE(mirage, kernel, alloc_pages, return, return);
+SDT_PROBE_DEFINE(mirage, kernel, io_page, contigmalloc, contigmalloc);
+SDT_PROBE_ARGTYPE(mirage, kernel, io_page, contigmalloc, 0, "size_t");
+SDT_PROBE_ARGTYPE(mirage, kernel, io_page, contigmalloc, 1, "unsigned long");
CAMLprim value caml_alloc_pages(value n_pages);
@@ -58,6 +61,7 @@ caml_alloc_pages(value n_pages)
SDT_PROBE(mirage, kernel, alloc_pages, entry, len, 0, 0, 0, 0);
block = (unsigned long) contigmalloc(PAGE_SIZE * len, M_MIRAGE,
M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0ul);
+ SDT_PROBE(mirage, kernel, io_page, contigmalloc, PAGE_SIZE * len, block, 0, 0, 0);
if (block == 0)
caml_failwith("contigmalloc");
result = caml_alloc(len, 0);
View
21 packages/mirage-platform/runtime/ocaml/bigarray_stubs.c
@@ -16,6 +16,9 @@
#ifdef _KERNEL
#include <sys/cdefs.h>
#include <machine/stdarg.h>
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/sdt.h>
#else
#include <stddef.h>
#include <stdarg.h>
@@ -35,6 +38,18 @@
#define int16 caml_ba_int16
#define uint16 caml_ba_uint16
+#ifdef _KERNEL
+SDT_PROVIDER_DECLARE(mirage);
+
+SDT_PROBE_DEFINE(mirage, kernel, io_page, contigfree, contigfree);
+SDT_PROBE_ARGTYPE(mirage, kernel, io_page, contigfree, 0, "void *");
+SDT_PROBE_ARGTYPE(mirage, kernel, io_page, contigfree, 1, "unsigned long");
+
+SDT_PROBE_DEFINE(mirage, kernel, io_page, refcount, refcount);
+SDT_PROBE_ARGTYPE(mirage, kernel, io_page, refcount, 0, "void *");
+SDT_PROBE_ARGTYPE(mirage, kernel, io_page, refcount, 1, "int");
+#endif
+
CAMLprim value caml_ba_create(value vkind, value vlayout, value vdim);
CAMLprim value caml_ba_get_N(value vb, value * vind, int nind);
CAMLprim value caml_ba_get_1(value vb, value vind1);
@@ -569,13 +584,19 @@ static void caml_ba_finalize(value v)
case CAML_BA_MANAGED:
if (b->proxy == NULL) {
#ifdef _KERNEL
+ SDT_PROBE(mirage, kernel, io_page, contigfree, b->data, PAGE_SIZE, 0,
+ 0, 0);
contigfree(b->data, PAGE_SIZE, M_MIRAGE);
#else
free(b->data);
#endif
} else {
+ SDT_PROBE(mirage, kernel, io_page, refcount, b->proxy->data,
+ (int) b->proxy->refcount, 0, 0, 0);
if (-- b->proxy->refcount == 0) {
#ifdef _KERNEL
+ SDT_PROBE(mirage, kernel, io_page, contigfree, b->proxy->data,
+ PAGE_SIZE, 0, 0, 0);
contigfree(b->proxy->data, PAGE_SIZE, M_MIRAGE);
#else
free(b->proxy->data);
Please sign in to comment.
Something went wrong with that request. Please try again.