blob: 8bfe79e5f7fff9bbd7fa3a7d80c0f71c5a3f567d (
plain)
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
|
/**
* Copyright (C) ARM Limited 2014-2016. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef FTRACEDRIVER_H
#define FTRACEDRIVER_H
#include <pthread.h>
#include "Driver.h"
class DynBuf;
// The Android NDK doesn't provide an implementation of pthread_barrier_t, so implement our own
class Barrier {
public:
Barrier();
~Barrier();
void init(unsigned int count);
void wait();
private:
pthread_mutex_t mMutex;
pthread_cond_t mCond;
unsigned int mCount;
};
class FtraceDriver : public SimpleDriver {
public:
FtraceDriver();
~FtraceDriver();
void readEvents(mxml_node_t *const xml);
bool prepare(int *const ftraceFds);
void start();
void stop(int *const ftraceFds);
bool readTracepointFormats(const uint64_t currTime, Buffer *const buffer, DynBuf *const printb, DynBuf *const b);
bool isSupported() const { return mSupported; }
private:
int64_t *mValues;
Barrier mBarrier;
int mSupported : 1,
mMonotonicRawSupport : 1,
mUnused0 : 30;
int mTracingOn;
// Intentionally unimplemented
FtraceDriver(const FtraceDriver &);
FtraceDriver &operator=(const FtraceDriver &);
};
#endif // FTRACEDRIVER_H
|