Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 87cdbe79694e9908ac1366cffc28e12a6e5abc89 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*******************************************************************************
 * Copyright (c) 2018 Ecole Polytechnique de Montreal
 *
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0 which
 * accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/

package org.eclipse.tracecompass.incubator.internal.ftrace.core.event;

import java.util.regex.Pattern;

import org.eclipse.jdt.annotation.NonNullByDefault;

/**
 * Constants for the ftrace format
 *
 * @author Guillaume Champagne
 * @author Alexis-Maurer Fortin
 * @author Hugo Genesse
 * @author Pierre-Yves Lajoie
 * @author Eva Terriault
 */
@NonNullByDefault
public interface IGenericFtraceConstants {

    /**
     * Character that identifies a comment when at the start of a line
     */
    String FTRACE_COMMENT_CHAR = "#"; //$NON-NLS-1$

    /**
     * Timestamp field name
     */
    String TIMESTAMP = "ts"; //$NON-NLS-1$
    /**
     * Name field name
     */
    String NAME = "name"; //$NON-NLS-1$
    /**
     * TID field name
     */
    String TID = "tid"; //$NON-NLS-1$
    /**
     * PID field name
     */
    String PID = "pid"; //$NON-NLS-1$

    /**
     * Pattern to match an ftrace event line
     */
    Pattern FTRACE_PATTERN = Pattern.compile("^\\s*(?<comm>.*)-(?<pid>\\d+)(?:\\s+\\([^0-9]*(?<tgid>\\d+)?\\))?\\s+\\[(?<cpu>\\d+)\\](?:\\s+....)?\\s+(?<timestamp>[0-9]+(?<us>\\.[0-9]+)?): (?<name>\\w+:\\s+)+(?<data>.+)"); //$NON-NLS-1$
    /**
     * comm group in {@link IGenericFtraceConstants#FTRACE_PATTERN}
     */
    String FTRACE_COMM_GROUP = "comm"; //$NON-NLS-1$
    /**
     * PID group in {@link IGenericFtraceConstants#FTRACE_PATTERN}
     */
    String FTRACE_PID_GROUP = "pid"; //$NON-NLS-1$
    /**
     * CPU group in {@link IGenericFtraceConstants#FTRACE_PATTERN}
     */
    String FTRACE_CPU_GROUP = "cpu"; //$NON-NLS-1$
    /**
     * Timestamp group in {@link IGenericFtraceConstants#FTRACE_PATTERN}
     */
    String FTRACE_TIMESTAMP_GROUP = "timestamp"; //$NON-NLS-1$
    /**
     * Name group in {@link IGenericFtraceConstants#FTRACE_PATTERN}
     */
    String FTRACE_NAME_GROUP = "name"; //$NON-NLS-1$
    /**
     * Data group in {@link IGenericFtraceConstants#FTRACE_PATTERN}
     */
    String FTRACE_DATA_GROUP = "data"; //$NON-NLS-1$
    /**
     * TGID group in {@link IGenericFtraceConstants#FTRACE_PATTERN}
     */
    String FTRACE_TGID_GROUP = "tgid"; //$NON-NLS-1$
}

Back to the top