Convert documentation to AsciiDoc
[lttng-docs.git] / CONTRIBUTING.adoc
CommitLineData
f0287ae1
PP
1The LTTng Documentation: Contributor's guide
2============================================
3Philippe Proulx
4v1.0, 21 October 2016
5
6This guide presents the structure and conventions of the LTTng
7Documentation's source. Make sure you read it thoroughly before
8you contribute a change.
9
10
11[[principles]]
12== Principles
13
14The LTTng Documentation exists to make the
15https://lttng.org/[LTTng project] useable.
16Without such a complete documentation consolidating the various
17concepts, features, and procedures of LTTng-tools, LTTng-UST, and
18LTTng-modules, most of the project would only be useable by
19its authors.
20
21Why not simply read the man pages? While the LTTng man pages are
22complementary to the LTTng Documentation, they remain formal
23references: they lack the introductory quality and procedural user
24guides found in this documentation.
25
26The core principle of the LTTng Documentation is to make the text as
27cleverly organized, easy to follow, precise, and consistent as possible.
28This involves keeping a high level of rigor as to such things as the
29document's style, voice, grammar, and layout.
30
31Of course, those guidelines are not new to the technical writing realm,
32and it would be bold to devise a brand new manual of style for the sole
33existence of the LTTng Documentation when so many have already proven
34their value. This is why the LTTng Documentation (especially starting
35from version 2.7) does its best to follow the rules of the
36https://en.wikipedia.org/wiki/Microsoft_Manual_of_Style[Microsoft Manual
37of Style (4th edition)], a landmark work in its field. Of particular
38interest in this book are:
39
40* Chapter 1, _Microsoft style and voice_.
41* Chapter 6, _Procedures and technical content_.
42* Chapter 7, _Practical issues of style_.
43* Chapter 8, _Grammar_.
44* Chapter 9, _Punctuation_.
45* Chapter 11, _Acronyms and other abbreviations_.
46
47The <<terminology,Terminology>> section of this contributor's guide
48adds terms to or overrides terms of Part 2, _Usage Dictionary_.
49
50
51== Organization of the repository and format
52
53The Git repository of the LTTng Documentation contains all the official
54versions of the documentation as separate source files. Each source file
55is in its own +2.__x__+ directory, along with documentation resources
56specific to this version of LTTng. You can find common source files in
57the `common` directory.
58
59The source files are written in
60http://www.methods.co.nz/asciidoc/[AsciiDoc], a rich, lightweight markup
61language with all the blocks and inline elements needed to write
62backend-agnostic content.
63
64Although the official LTTng website uses a custom script to generate
65its own HTML version of the LTTng Documentation, it is possible to
66generate an autonomous HTML preview (see
67link:README.adoc[`README.adoc`]). The `asciidoc.html5.conf` AsciiDoc
68configuration file sets a few attributes and implements the required
69macros for this preview target.
70
71
72== Validation script
73
74Before you submit any change, make sure that the check script passes.
75This is a Python script which validates some elements of a specific
76document.
77
78You need the following dependencies to run the check script:
79
80* http://www.methods.co.nz/asciidoc/[AsciiDoc]
81* Python 3
82* http://lxml.de/[lxml] Python 3 package
83* https://pypi.python.org/pypi/termcolor[termcolor] Python 3 package
84
85Run the check script:
86
87----
88python3 tools/check.py 2.7/lttng-docs-2.7.txt
89----
90
91Replace `2.7` by the version of the document to validate in the previous
92command line.
93
94
95== Style considerations
96
97As stated in <<principles,Principles>>, the LTTng Documentation follows
98the Microsoft Manual of Style (4th edition). We encourage you to read
99this work before contributing a major change to the document.
100
101You also need to consider the following rules, often specific to the
102AsciiDoc format used to write the LTTng Documentation, when you edit
103existing content or when you create new sections.
104
105
106=== Macros
107
108* **Man page references**: Always use the +man:__command__(__section__)+
109 macro you refer to a man page. The official online version of the
110 LTTng Documentation has hyperlinks to the correct online versions
111 of the LTTng man pages thanks to this macro.
112+
113.Using the `man` macro.
114====
115----
116See man:lttng-ust(3) for more details about ...
117----
118====
119
120* **File names**: Always use the +path:{__path__}+
121 macro when you need to write a file name.
122+
123.Using the `path` macro.
124====
125----
126Load the configuration file path:{hello.lttng} directory by default.
127----
128====
129
130* **Directory names**: Always use the +dir:{__path__}+
131 macro when you need to write a directory name.
132+
133.Using the `dir` macro.
134====
135----
136Traces are recorded to the dir:{~/lttng-traces} directory by default.
137----
138====
139
140* **Environment variable**: Always use the +env:__VAR__+ macro when
141 you need to write an environment variable name. +__VAR__+ must not
142 contain the shell's `$` prefix.
143+
144.Using the `env` macro.
145====
146----
147You can set the env:LTTNG_UST_DEBUG environment variable to `1` to
148activate LTTng-UST's debug output.
149----
150====
151
152* **Command names**: Always use the +cmd:__cmd__+
153 macro when you need to write a command name.
154+
155.Using the `cmd` macro.
156====
157----
158Run cmd:lttng-sessiond as the root user.
159----
160====
161
162
163=== Dashes
164
165Em dashes can usually be written using `--` in AsciiDoc, but sometimes
166the two hyphens are outputted as is, for example if the character at the
167left or at the right of them is a punctuation. You can avoid this
168by using the equivalent `&#8212;` HTML entity.
169
170.Using `--` for an em dash.
171====
172----
173And yet, when the car was finally delivered--nearly three months after it
174was ordered--she decided she no longer wanted it, leaving the dealer with
175an oddly equipped car that would be difficult to sell.
176----
177====
178
179.Using `&#8212;` for an em dash.
180====
181----
182As the frequency of recorded events increases--either because the event
183throughput is actually higher or because you enabled more events than
184usual&#8212;__event loss__ might be experienced.
185----
186====
187
188
189=== Non-breaking spaces
190
191Always use a non-breaking space (`{nbsp}`, or HTML entity `&#160;`)
192between a quantity and its unit, or when it would be unnatural to have
193two related words split on two lines.
194
195.Using a non-breaking space between a quantity and its unit.
196====
197----
198The size of this file is 1039{nbsp}bytes.
199----
200====
201
202.Using a non-breaking space to avoid an odd line break.
203====
204----
205This integer is displayed in base{nbsp}16.
206----
207====
208
209
210=== Placeholders in inline code
211
212When a section of an inline code element is a placeholder, or variable,
213use the `+` form of the element (instead of +&#96;+), and place `__`
214around the placeholder.
215
216.Using a placeholder in an inline code element.
217====
218----
219Name your file +something.__sys__.c+, where +__sys__+ is your system name.
220----
221====
222
223
224=== Listing blocks
225
226There are two types of listing blocks:
227
228* [[term-box]]**Terminal boxes** are used to show commands to be entered in a
229 terminal exclusively, that is, the output of commands must not be
230 written in terminal boxes. A terminal box is an AsciiDoc literal
231 block with the `term` role.
232+
233.Using a terminal box.
234====
235[listing]
236....
237[role="term"]
238----
239lttng create my-session
240lttng enable-event --kernel --all
241----
242....
243====
244+
245The output of a command line can be written using a simple, role-less
246listing block.
247
248* **Source code boxes** are used to show syntax-highlighted snippets of
249 source code. A source code box is an AsciiDoc source code block.
250+
251.Using a source code box.
252====
253[listing]
254....
255[source,c]
256----
257#include <stdio.h>
258
259int main(void)
260{
261 puts("Hello, World!");
262
263 return 0;
264}
265----
266....
267====
268+
269The second attribute is the name of the programming language for
270proper syntax highlighting (for example, `c`, `python`, `make`, `java`).
271This name must be known to http://pygments.org/[Pygments].
272+
273Always indent source code examples with 4{nbsp}spaces.
274
275In any listing block, the lines must not exceed 80 characters (prefer a
276maximum of 72 characters).
277
278
279=== Command-line options
280
281When specifying command-line options:
282
283* Always use the long form of the option (with two hyphens).
284* Use a code element for the option name (backticks).
285* Always follow the option name by the _option_ word.
286
287.Using a command-line option.
288====
289----
290You can use the `lttng` tool's `--group` option to specify a custom
291tracing group.
292----
293====
294
295In <<term-box,terminal boxes>>, always put `=` between the option name
296and its argument, if any.
297
298.Terminal box.
299====
300In this example, `provider:'sys_*'` is not the argument of the
301`--userspace` option: it's the first positional argument, and
302the `--userspace` option has no arguments.
303
304[listing]
305....
306[role="term"]
307----
308lttng enable-event --userspace provider:'sys_*' --filter='field < 23'
309 --exclude=sys_send,sys_block --loglevel=TRACE_INFO
310----
311....
312====
313
314
315=== Procedures
316
317Use an ordered list to write a procedure.
318
319If a step is optional, prepend `**Optional**:` followed by a space to
320the step's first sentence. Start the first sentence with a capital
321letter. Do not use an optional step followed by a condition; use a
322conditional step for this.
323
324If a step is conditional, put the condition (_If something_) in bold,
325followed by a comma, followed by the step itself.
326
327
328=== External links
329
330When using a hyperlink to an LTTng repository's file or directory,
331link to the GitHub code browser. Make sure to link to the appropriate
332Git branch (usually +stable-2.__x__+). You can use the `revision`
333attribute in the URL.
334
335.Link to source file.
336====
337----
338See the file
339https://github.com/lttng/lttng-tools/blob/stable-{revision}/src/common/daemonize.c[path:{src/common/daemonize.c}]
340for more details about [...]
341----
342====
343
344
345=== "Since" sections
346
347If a whole section describes a feature which was introduced in LTTng 2.1
348or later, add the +since-2.__x__+ role to the section's heading, where
349+__x__+ is the minor version of the LTTng release which introduced
350the feature.
351
352.Section heading describing a feature introduced in LTTng 2.5.
353====
354----
355[role="since-2.5"]
356[[tracef]]
357==== Use `tracef()`
358----
359====
360
361
362[[terminology]]
363== Terminology
364
365What follows is an official, partial list of technical terms used by the
366LTTng Documentation. Other forms of those terms are _not_ permitted. For
367example, do not write `use-case` or `filesystem`.
368
369Autotools::
370 The GNU Autotools.
371+
372Do not use _autotools_.
373
374Babeltrace::
375 The Babeltrace project, which includes the `babeltrace` command, some
376 libraries, and Python bindings.
377+
378Use +&#96;babeltrace&#96;+ to refer to the actual `babeltrace` command.
379
380Babeltrace Python bindings::
381 The Python bindings of Babeltrace.
382+
383The plural _bindings_ is important.
384
385Bash::
386 The Bash shell.
387+
388Do not use _bash_.
389
390buffering scheme::
391 A layout of tracing buffers applied to a given channel.
392
393channel::
394 An LTTng channel.
395
396CLI::
397 Prefer expanding this acronym to _command-line interface_ in the text.
398
399clock::
400 A reference of time for a tracer.
401+
402Use _system time_ to refer to the date and time as seen by a user.
403
404command-line::
405 Adjective version of _command line_: _command-line option_,
406 _command-line interface_.
407
408command-line interface::
409 An interface in which the user enters command lines to instruct the
410 system what to do.
411+
412Prefer using _command_ or _command-line tool_ to refer to a
413specific command.
414
415command line::
416 An actual line of command entered by the user in a terminal, at a
417 command prompt.
418+
419Write _command-line_ when used as an adjective.
420
421consumer daemon::
422 The LTTng consumer daemon.
423+
424Do not use _consumerd_.
425+
426Use +&#96;lttng-consumerd&#96;+ to refer to the consumer daemon
427executable.
428
429domain::
430 Do not use when referring to a _tracing domain_.
431
432event::
433 Occurrence recognised by software, emitted by a tracer when specific
434 conditions are met, at a given time. An event _occurs_ at a specific
435 time, after which a tracer can record its payload.
436
437event loss mode::
438 The mechanism by which event records of a given channel are lost
439 (not recorded) when there is no sub-buffer space left to store them.
440
441event name::
442 The name of an event, which is also the name of the event record.
443 This is different from a _tracepoint name_, which is only the name
444 of the instrumentation point, not necessarily equal to the event
445 name.
446
447event record::
448 Record, in a trace, of the payload of an event which occured.
449
450event rule::
451 Set of conditions which must be satisfied for one or more events
452 to occur. The `lttng enable-event` command creates and enables
453 _event rules_, not _events_.
454
455file system::
456 Contains directories, files, and links in an organized structure.
457+
458Do not use _filesystem_ or _file-system_.
459
460+&#96;java.util.logging&#96;+::
461 Even though the `--jul` command-line option is an acronym for this
462 term, there is no such thing as _Java Util Logging_. The only
463 correct form is the name of the Java package,
464 +&#96;java.util.logging&#96;+.
465
466instrumentation::
467 The use of LTTng probes to make a software traceable.
468
469libc::
470 Do not use.
471+
472Use _the C standard library_ to refer to the standard library for
473the C programming language, or _glibc_ to refer to the GNU C Library
474specifically.
475
476log4j::
477 LTTng-UST supports Java logging using Apache _log4j_, not Apache
478 Log4j 2.
479
480log level::
481 Level of severity of a log statement.
482+
483Do not hyphenate.
484
485kernel::
486 In general, do not use _kernel_ to refer to the _Linux kernel_: use
487 the whole _Linux kernel_ term, because other operating system kernels
488 exist. Since the _L_ in _LTTng_ means _Linux_, it's okay to use _LTTng
489 kernel modules_.
490
491Linux Trace Toolkit: next generation::
492 The expansion of the _LTTng_ acronym.
493+
494The colon and the lowercase _n_ and _g_ are important.
495
496LTTng-analyses::
497 The LTTng-analyses project.
498
499LTTng-modules::
500 The LTTng-modules project.
501
502LTTng-tools::
503 The LTTng-tools project.
504
505LTTng-UST::
506 The LTTng-UST project.
507
508LTTng-UST Java agent::
509LTTng-UST Python agent::
510 An LTTng user space agent.
511+
512Do not use _Java LTTng-UST agent_ or _Python LTTng-UST agent_.
513
514LTTng Documentation::
515 The name of this project.
516+
517Do not use _LTTng documentation_.
518+
519When referring to the project, the _the_ determiner can be lowercase:
520_Welcome to the LTTng Documentation!_.
521
522LTTng live::
523 The name of a communication protocol between Babeltrace and the
524 relay daemon which makes it possible to see events "live",
525 as they are received by the relay daemon.
526+
527Do not hyphenate.
528
529the +&#96;lttng&#96;+ tool::
530the +&#96;lttng&#96;+ command line tool::
531 The `lttng` command line tool.
532+
533When _tool_ has been mentioned in the previous sentences, you can use
534+&#96;lttng&#96;+ alone.
535
536Makefile::
537 An input for the make tool.
538+
539Do not use _makefile_ or _make file_.
540
541man page::
542 Unix-style reference manual page.
543+
544Do not hyphenate.
545
546per-process buffering::
547 A buffering scheme in which each process has its own buffer for a
548 given user space channel.
549+
550Do not use _per-PID buffering_.
551
552per-user buffering::
553 A buffering scheme in which all the processes of a user share the same
554 buffer for a given user space channel.
555+
556Do not use _per-UID buffering_.
557
558probe::
559 An instrumentation point.
560+
561Prefer _tracepoint_ when referring to a user space or Linux kernel
562LTTng tracepoint.
563
564real-time clock::
565 A clock which keeps track of the current time, including eventual
566 time corrections.
567+
568Do not use _realtime clock_ or _real time clock_.
569
570relay daemon::
571 The LTTng relay daemon.
572+
573Do not use _relayd_.
574+
575Use +&#96;lttng-relayd&#96;+ to refer to the relay daemon executable.
576
577root user::
578 A superuser of a Linux system.
579+
580Do not use +&#96;root&#96;+.
581
582session::
583 Do not use when referring to a _tracing session_.
584
585session daemon::
586 The LTTng session daemon.
587+
588Do not use _sessiond_.
589+
590Use +&#96;lttng-sessiond&#96;+ to refer to the session daemon
591executable.
592
593snapshot::
594 Copy of the current data of all the buffers of a given tracing
595 session, saved as a trace.
596
597sub-buffer::
598 One part of an LTTng ring buffer.
599+
600Do not use _subbuffer_ since it's harder to read with the two
601contiguous b's.
602
603timestamp::
604 Time information attached to an event when it is emitted. This is not
605 necessarily a _Unix timestamp_.
606+
607Do not use _time stamp_.
608
609trace::
610 As a verb: a user or a tracer can _trace_ an application.
611
612Trace Compass::
613 The Trace Compass project and application.
614+
615Do not hyphenate. Do not use _Trace compass_, _TraceCompass_, or
616_Tracecompass_.
617
618tracepoint::
619 An instrumentation point using the tracepoint mechanism of
620 the Linux kernel or of LTTng-UST.
621+
622Do not use _trace point_ or _trace-point_.
623
624tracepoint definition::
625 The definition of a single tracepoint.
626
627tracepoint name::
628 The name of a _tracepoint_.
629+
630Not to be confused with an _event name_.
631
632tracepoint provider::
633 A set of functions providing tracepoints to an instrumented user
634 application.
635+
636Not to be confused with a _tracepoint provider package_: many tracepoint
637providers can exist within a tracepoint provider package.
638
639tracepoint provider package::
640 One or more tracepoint providers compiled as an object file or as
641 a shared library.
642
643tracing domain::
644 An LTTng tracing domain.
645+
646Always use the complete _tracing domain_ term, not _domain_ alone,
647unless _tracing domain_ has been used in the few preceding sentences.
648
649tracing group::
650 The Unix group in which a user can be to be allowed to trace the
651 Linux kernel.
652+
653Do not use _&#96;tracing&#96; group_, as the name of the tracing
654group is configurable.
655
656tracing session::
657 An LTTng tracing session.
658+
659Always use the complete _tracing session_ term, not _session_ alone.
660
661Unix::
662 Unix operating system or philosophy.
663+
664Do not use _UNIX_.
665
666Unix epoch::
667 Absolute reference of a real-time clock.
668+
669Use the term as a proper noun: do not precede it with _the_.
670+
671Do not use _Epoch_ alone.
672
673Unix timestamp::
674 Timestamp represented as the number of seconds since Unix epoch.
675
676use case::
677 According to Wikipedia: List of actions or event steps, typically
678 defining the interactions between a role and a system, to
679 achieve a goal.
680+
681Do not hyphenate.
682
683user application::
684 An application running in user space, as opposed to a Linux kernel
685 module, for example.
686+
687Do not use _user space application_, as this is redundant.
688
689user space::
690 User processes.
691+
692Do not hyphenate.
This page took 0.04494 seconds and 4 git commands to generate.