Warner Losh
2021-05-31 23:23:56 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/doc/commit/?id=293f155765ee12c857f818b9e9d9e94cc61323a4
commit 293f155765ee12c857f818b9e9d9e94cc61323a4
Author: Warner Losh <***@FreeBSD.org>
AuthorDate: 2021-04-27 21:07:35 +0000
Commit: Warner Losh <***@FreeBSD.org>
CommitDate: 2021-05-31 23:23:35 +0000
arch-handbook: Document PROLOG and EPILOG
PROLOG and EPILOG modifiers are used to set code to insert before or
after the method is called. It's use cases are limited. It is intended
to only be used only for tracing or other profling.
Sponsored by: Netflix
---
documentation/content/en/books/arch-handbook/kobj/_index.adoc | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/documentation/content/en/books/arch-handbook/kobj/_index.adoc b/documentation/content/en/books/arch-handbook/kobj/_index.adoc
index 32b64e3bbd..0b81112792 100644
--- a/documentation/content/en/books/arch-handbook/kobj/_index.adoc
+++ b/documentation/content/en/books/arch-handbook/kobj/_index.adoc
@@ -118,7 +118,7 @@ KOBJMETHOD(NAME, FUNC)
The first step in using Kobj is to create an Interface.
Creating the interface involves creating a template that the script [.filename]#src/sys/kern/makeobjops.pl# can use to generate the header and code for the method declarations and method lookup functions.
-Within this template the following keywords are used: `#include`, `INTERFACE`, `CODE`, `HEADER`, `METHOD`, `STATICMETHOD`, and `DEFAULT`.
+Within this template the following keywords are used: `#include`, `INTERFACE`, `CODE`, `EPILOG`, `HEADER`, `METHOD`, `PROLOG`, `STATICMETHOD`, and `DEFAULT`.
The `#include` statement and what follows it is copied verbatim to the head of the generated code file.
@@ -202,6 +202,9 @@ The `STATICMETHOD` keyword is used like the `METHOD` keyword except the kobj dat
Instead `STATICMETHOD` relies on the Kobj data being referenced as 'ops'.
This is also useful for calling methods directly out of a class's method table.
+The `PROLOG` and `EPILOG` keywords sets inserts code immediately before or directly after the `METHOD` they are attached to.
+This feature is used primarily for profiling situations where it's difficult to obtain the information in another way.
+
Other complete examples:
[.programlisting]
URL: https://cgit.FreeBSD.org/doc/commit/?id=293f155765ee12c857f818b9e9d9e94cc61323a4
commit 293f155765ee12c857f818b9e9d9e94cc61323a4
Author: Warner Losh <***@FreeBSD.org>
AuthorDate: 2021-04-27 21:07:35 +0000
Commit: Warner Losh <***@FreeBSD.org>
CommitDate: 2021-05-31 23:23:35 +0000
arch-handbook: Document PROLOG and EPILOG
PROLOG and EPILOG modifiers are used to set code to insert before or
after the method is called. It's use cases are limited. It is intended
to only be used only for tracing or other profling.
Sponsored by: Netflix
---
documentation/content/en/books/arch-handbook/kobj/_index.adoc | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/documentation/content/en/books/arch-handbook/kobj/_index.adoc b/documentation/content/en/books/arch-handbook/kobj/_index.adoc
index 32b64e3bbd..0b81112792 100644
--- a/documentation/content/en/books/arch-handbook/kobj/_index.adoc
+++ b/documentation/content/en/books/arch-handbook/kobj/_index.adoc
@@ -118,7 +118,7 @@ KOBJMETHOD(NAME, FUNC)
The first step in using Kobj is to create an Interface.
Creating the interface involves creating a template that the script [.filename]#src/sys/kern/makeobjops.pl# can use to generate the header and code for the method declarations and method lookup functions.
-Within this template the following keywords are used: `#include`, `INTERFACE`, `CODE`, `HEADER`, `METHOD`, `STATICMETHOD`, and `DEFAULT`.
+Within this template the following keywords are used: `#include`, `INTERFACE`, `CODE`, `EPILOG`, `HEADER`, `METHOD`, `PROLOG`, `STATICMETHOD`, and `DEFAULT`.
The `#include` statement and what follows it is copied verbatim to the head of the generated code file.
@@ -202,6 +202,9 @@ The `STATICMETHOD` keyword is used like the `METHOD` keyword except the kobj dat
Instead `STATICMETHOD` relies on the Kobj data being referenced as 'ops'.
This is also useful for calling methods directly out of a class's method table.
+The `PROLOG` and `EPILOG` keywords sets inserts code immediately before or directly after the `METHOD` they are attached to.
+This feature is used primarily for profiling situations where it's difficult to obtain the information in another way.
+
Other complete examples:
[.programlisting]