Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Profile low-privileged processes with perf_events (#411)
- Loading branch information
Showing
16 changed files
with
811 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright 2021 Andrei Pangin | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef _FDTRANSFER_H | ||
#define _FDTRANSFER_H | ||
|
||
#ifdef __linux__ | ||
|
||
#include "fdtransfer/fdTransfer_shared_linux.h" | ||
|
||
class FdTransferClient { | ||
private: | ||
static int _peer; | ||
|
||
static int recvFd(unsigned int request_id, struct fd_response *resp, size_t resp_size); | ||
|
||
public: | ||
static bool connectToServer(const char *path, int pid); | ||
static bool hasPeer() { return _peer != -1; } | ||
static void closePeer() { | ||
if (_peer != -1) { | ||
close(_peer); | ||
_peer = -1; | ||
} | ||
} | ||
|
||
static int requestPerfFd(int *tid, struct perf_event_attr *attr); | ||
static int requestKallsymsFd(); | ||
}; | ||
|
||
#else | ||
|
||
class FdTransferClient { | ||
public: | ||
static bool connectToServer(const char *path, int pid) { return false; } | ||
static bool hasPeer() { return false; } | ||
static void closePeer() { } | ||
}; | ||
|
||
#endif // __linux__ | ||
|
||
#endif // _FDTRANSFER_H |
Oops, something went wrong.