Skip to content

Commit 9a802f9

Browse files
author
Javid Habibi
committed
Initial commit of preview from AZDO
1 parent 300dce0 commit 9a802f9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+266627
-44
lines changed

.gitignore

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,57 @@
11
# Prerequisites
22
*.d
33

4-
# Object files
4+
# Compiled Object files
5+
*.slo
6+
*.lo
57
*.o
6-
*.ko
78
*.obj
8-
*.elf
9-
10-
# Linker output
11-
*.ilk
12-
*.map
13-
*.exp
149

1510
# Precompiled Headers
1611
*.gch
1712
*.pch
1813

19-
# Libraries
20-
*.lib
21-
*.a
22-
*.la
23-
*.lo
24-
25-
# Shared objects (inc. Windows DLLs)
26-
*.dll
14+
# Compiled Dynamic libraries
2715
*.so
28-
*.so.*
2916
*.dylib
17+
*.dll
18+
19+
# Fortran module files
20+
*.mod
21+
*.smod
22+
23+
# Compiled Static libraries
24+
*.lai
25+
*.la
26+
*.a
27+
*.lib
3028

3129
# Executables
3230
*.exe
3331
*.out
3432
*.app
35-
*.i*86
36-
*.x86_64
37-
*.hex
38-
39-
# Debug files
40-
*.dSYM/
41-
*.su
42-
*.idb
43-
*.pdb
44-
45-
# Kernel Module Compile Results
46-
*.mod*
47-
*.cmd
48-
.tmp_versions/
49-
modules.order
50-
Module.symvers
51-
Mkfile.old
52-
dkms.conf
33+
34+
# Logs
35+
*.log
36+
*.db
37+
38+
# CMake
39+
CMakeLists.txt.user
40+
CMakeCache.txt
41+
CMakeFiles
42+
CMakeScripts
43+
Testing
44+
Makefile
45+
cmake_install.cmake
46+
install_manifest.txt
47+
compile_commands.json
48+
CTestTestfile.cmake
49+
50+
# build artifacts
51+
bin/
52+
build/
53+
obj/
54+
pkgbuild/
55+
56+
# dev env
57+
.vscode/

CMakeLists.txt

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
cmake_minimum_required (VERSION 3.13)
2+
project (procmon)
3+
4+
# Set the project version number.
5+
set (procmon_VERSION_MAJOR 0)
6+
set (procmon_VERSION_MINOR 1)
7+
set (procmon_VERSION_PATCH 0)
8+
9+
# make ncurses a requirement
10+
find_package(Curses REQUIRED)
11+
12+
# Configure version header file to pass CMake settings to source code.
13+
configure_file (
14+
"${PROJECT_SOURCE_DIR}/src/version.h.in"
15+
"${PROJECT_BINARY_DIR}/src/version.h"
16+
)
17+
18+
include(FetchContent)
19+
20+
# Fetch bcc.
21+
# TODO: Consider maybe making this a CMake script to be called.
22+
FetchContent_Declare(
23+
bcc
24+
GIT_REPOSITORY https://github.com/iovisor/bcc.git
25+
GIT_TAG v0.10.0
26+
)
27+
28+
FetchContent_GetProperties(bcc)
29+
if(NOT bcc_POPULATED)
30+
FetchContent_Populate(bcc)
31+
add_subdirectory(${bcc_SOURCE_DIR} ${bcc_BINARY_DIR} EXCLUDE_FROM_ALL)
32+
endif()
33+
34+
# Include Sqlite3 amalgamation.
35+
add_library(sqlite3-static STATIC
36+
"${CMAKE_SOURCE_DIR}/vendor/sqlite3/sqlite3.c"
37+
)
38+
set_target_properties(sqlite3-static
39+
PROPERTIES
40+
INTERFACE_LINK_LIBRARIES "dl;pthread"
41+
)
42+
43+
# Fetch Catch2 testing framework.
44+
FetchContent_Declare(
45+
Catch2
46+
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
47+
GIT_TAG v2.7.2
48+
)
49+
FetchContent_MakeAvailable(Catch2)
50+
51+
# Set compiler flags.
52+
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fno-omit-frame-pointer -DELPP_THREAD_SAFE -D ELPP_DEFAULT_LOG_FILE='\"/var/log/procmon.log\"'")
53+
set (CMAKE_CXX_STANDARD 17)
54+
55+
# Include required versioning, bcc, logging and sqlite3 header files.
56+
include_directories(
57+
"${PROJECT_BINARY_DIR}/src/"
58+
"/usr/include/bcc/compat"
59+
"${bcc_SOURCE_DIR}/src/cc/api"
60+
"${bcc_SOURCE_DIR}/src/cc"
61+
"${CMAKE_SOURCE_DIR}/vendor/sqlite3"
62+
${CURSES_INCLUDE_DIR}
63+
)
64+
65+
enable_testing()
66+
67+
# Create a static library target for each subdirectory.
68+
add_subdirectory(src/common)
69+
add_subdirectory(src/configuration)
70+
add_subdirectory(src/storage)
71+
add_subdirectory(src/tracer)
72+
add_subdirectory(src/display)
73+
add_subdirectory(src/logging)
74+
75+
# Add exectable and link all static libraries.
76+
#add_executable(procmon src/procmon.cpp)
77+
78+
add_executable(
79+
procmon
80+
src/procmon.cpp
81+
)
82+
83+
# Why does the order which these static libraries are listed matter here??
84+
target_link_libraries(
85+
procmon
86+
configuration-static
87+
tracer-static
88+
storage-static
89+
common-static
90+
bcc-static
91+
display-static
92+
${CURSES_LIBRARIES}
93+
-lpanel
94+
logging-static
95+
stdc++fs
96+
)
97+
98+
# setup general packing Variables
99+
set(CPACK_STRIP_FILES ON)
100+
set(CPACK_PACKAGE_NAME ${PROJECT_NAME} )
101+
set(CPACK_PACKAGE_VENDOR "Microsoft")
102+
set(CPACK_PACKAGE_CONTACT "OSS Tooling Dev Team [email protected]")
103+
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Procmon for Linux")
104+
set(CPACK_PACKAGE_DESCRIPTION "Procmon is a Linux reimagining of the classic Procmon tool from the Sysinternals suite of tools for Windows. Procmon provides a convenient and efficient way for Linux developers to trace the syscall activity on the system.")
105+
set(CPACK_PACKAGE_VERSION_MAJOR "${procmon_VERSION_MAJOR}")
106+
set(CPACK_PACKAGE_VERSION_MINOR "${procmon_VERSION_MINOR}")
107+
set(CPACK_PACKAGE_VERSION_PATCH "${procmon_VERSION_PATCH}")
108+
set(AZDO_BUILD_ID "999999")
109+
110+
# setup license and readme for package
111+
SET(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/LICENSE.txt)
112+
SET(CPACK_RESOURCE_FILE_README ${PROJECT_SOURCE_DIR}/README.md)
113+
114+
# setup CPACK RPM Variables
115+
set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
116+
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
117+
set(CPACK_RPM_PACKAGE_URL "https://github.com/Microsoft/Procmon-for-Linux")
118+
set(CPACK_RPM_PACKAGE_GROUP "Development/Tools")
119+
120+
# setup CPACK DEB Variables
121+
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
122+
set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
123+
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/Microsoft/Procmon-for-Linux")
124+
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "OSS Tooling Dev Team [email protected]")
125+
126+
# setup install
127+
INSTALL(TARGETS procmon DESTINATION /usr/bin)
128+
# INSTALL(FILES procmon.1 DESTINATION /usr/share/man/man1/)
129+
130+
# build debian package
131+
set(CPACK_GENERATOR "DEB")
132+
133+
# are we running on centos or ubuntu build agent?
134+
execute_process(COMMAND lsb_release -si OUTPUT_VARIABLE distro OUTPUT_STRIP_TRAILING_WHITESPACE)
135+
136+
if(distro STREQUAL "CentOS")
137+
set(CPACK_GENERATOR "RPM")
138+
execute_process(COMMAND uname -m OUTPUT_VARIABLE CPACK_RPM_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
139+
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-${AZDO_BUILD_ID}.${CPACK_RPM_PACKAGE_ARCHITECTURE})
140+
141+
elseif(distro STREQUAL "Ubuntu")
142+
set(CPACK_GENERATOR "DEB")
143+
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.26.1), libstdc++6 (>= 3.4.22), libncurses5 (>= 5.0)")
144+
execute_process(COMMAND dpkg --print-architecture OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
145+
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-${AZDO_BUILD_ID}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE})
146+
147+
endif()
148+
149+
include(CPack)

CONTRIBUTING.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Contributing
2+
3+
Before we can accept a pull request from you, you'll need to sign a [Contributor License Agreement (CLA)](https://cla.microsoft.com). It is an automated process and you only need to do it once.
4+
To enable us to quickly review and accept your pull requests, always create one pull request per issue and link the issue in the pull request. Never merge multiple requests in one unless they have the same root cause. Be sure to follow our Coding Guidelines and keep code changes as small as possible. Avoid pure formatting changes to code that has not been modified otherwise. Pull requests should contain tests whenever possible.
5+
6+
# Branching
7+
The master branch contains current development. While CI should ensure that master always builds, it is still considered pre-release code. Release checkpoints will be put into stable branches for maintenance.
8+
9+
To contribute, fork the repository and create a branch in your fork for your work. Please keep branch names short and descriptive. Please direct PRs into the upstream master branch.
10+
11+
## Build and run from source
12+
### Environment
13+
* `Linux` OS (dev team is using Ubuntu 18.04)
14+
* Development can be done on Windows Subsystem for Linux, but Procmon cannot be executed in that environment
15+
* `git`
16+
* `cmake` >= 3.13
17+
* `libsqlite3-dev` >= 3.22
18+
19+
```bash
20+
sudo apt-get -y install bison build-essential flex git libedit-dev \
21+
libllvm6.0 llvm-6.0-dev libclang-6.0-dev python zlib1g-dev libelf-dev
22+
```
23+
24+
##### 1. Build BCC
25+
```bash
26+
git clone --branch tag_v0.10.0 https://github.com/iovisor/bcc.git
27+
mkdir bcc/build
28+
cd bcc/build
29+
cmake .. -DCMAKE_INSTALL_PREFIX=/usr
30+
make
31+
sudo make install
32+
```
33+
34+
##### 2. Build Procmon
35+
```bash
36+
git clone <URL>
37+
cd procmon-for-linux
38+
mkdir build
39+
cd build
40+
cmake ..
41+
make
42+
```
43+
44+
## Pull Requests
45+
* Always tag a work item or issue with a pull request.
46+
* Limit pull requests to as few issues as possible, preferably 1 per PR
47+

INSTALL.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Install Procmon
2+
3+
## Ubuntu 18.04
4+
#### 1. Register Microsoft key and feed
5+
```sh
6+
wget -q https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
7+
sudo dpkg -i packages-microsoft-prod.deb
8+
```
9+
10+
#### 2. Install Procmon
11+
```sh
12+
sudo apt-get update
13+
sudo apt-get install procmon
14+
```
15+

0 commit comments

Comments
 (0)