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