Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coz: Causal profiler #3794

Merged
merged 24 commits into from
Jun 10, 2021
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f6ac437
coz: Causal profiler
klimkin Oct 20, 2020
e80c263
Cleanup config_options, since options.fPIC does not exist
klimkin Dec 5, 2020
f54c8ad
Patch Python version
klimkin Dec 5, 2020
88606ec
Disable incompatible Macos builds
klimkin Dec 5, 2020
fbd4f2b
Build test_package files with debug info
klimkin Dec 5, 2020
a01c632
Implement code-review fixes
klimkin Dec 14, 2020
96f5f4d
Use CMake from the package sources
klimkin Mar 23, 2021
147fb9b
Do not package lib/cmake
klimkin Mar 23, 2021
8ddad79
Pushed patch to upstream
klimkin Mar 23, 2021
5ad0119
Do not build for GCC version <5.0
klimkin Mar 23, 2021
e7b5f32
Require C++11 to match parent
klimkin May 25, 2021
6ce4b7f
Update recipes/coz/all/test_package/conanfile.py
klimkin May 25, 2021
75cd1ea
Update recipes/coz/all/conanfile.py
klimkin May 27, 2021
5a9fb5c
Apply suggestions from code review
klimkin May 27, 2021
1be6c09
Update recipes/coz/all/conanfile.py
klimkin May 27, 2021
13ac66d
Update recipes/coz/all/conanfile.py
klimkin May 27, 2021
9cb2928
Update recipes/coz/all/test_package/CMakeLists.txt
klimkin May 27, 2021
cbd9632
Minor cleanup
klimkin May 27, 2021
278e676
Update recipes/coz/all/conanfile.py
klimkin Jun 8, 2021
b3b2c0b
Update recipes/coz/all/conanfile.py
klimkin Jun 8, 2021
add55f5
Update recipes/coz/all/conanfile.py
klimkin Jun 8, 2021
898d5e8
Update recipes/coz/all/CMakeLists.txt
klimkin Jun 8, 2021
1d5defd
Use cmake template similar to other recipes
klimkin Jun 8, 2021
95b1852
Remove private system_libs dependencies since building always shared
klimkin Jun 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions recipes/coz/all/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.1)
klimkin marked this conversation as resolved.
Show resolved Hide resolved
project(coz)
klimkin marked this conversation as resolved.
Show resolved Hide resolved

include(conanbuildinfo.cmake)
conan_basic_setup()

add_subdirectory(source_subfolder)
4 changes: 4 additions & 0 deletions recipes/coz/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"cci.20210322":
url: "https://github.com/plasma-umass/coz/archive/6dd3c3f9cdce5094024aab49aeb1b6b44c73b220.zip"
sha256: "f6b8332df45190d300a9d7a9049e9817729080dbd099af3b02ea4ea6977f24dd"
58 changes: 58 additions & 0 deletions recipes/coz/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import os
from conans import ConanFile, CMake, tools
from conans.errors import ConanInvalidConfiguration


klimkin marked this conversation as resolved.
Show resolved Hide resolved
class CozConan(ConanFile):
name = "coz"
description = """Causal profiler, uses performance experiments
to predict the effect of optimizations"""
url = "https://github.com/conan-io/conan-center-index"
homepage = "http://coz-profiler.org"
license = "BSD-2-Clause"
topics = ("conan", "coz", "profiler", "causal")

settings = "os", "arch", "compiler", "build_type"

requires = "libelfin/0.3"
exports_sources = "CMakeLists.txt", "patches/*"
klimkin marked this conversation as resolved.
Show resolved Hide resolved
generators = "cmake", "cmake_find_package"

_source_subfolder = "source_subfolder"

def validate(self):
compiler = self.settings.compiler
compiler_version = tools.Version(self.settings.compiler.version)
if self.settings.os == "Macos" or compiler == "Visual Studio" or (
compiler == "gcc" and compiler_version < "5.0"):
raise ConanInvalidConfiguration(
"coz doesn't support compiler: {} on OS: {}.".format(
self.settings.compiler, self.settings.os))
if self.settings.compiler.cppstd:
tools.check_min_cppstd(self, "11")

def source(self):
tools.get(**self.conan_data["sources"][self.version],
destination=self._source_subfolder, strip_root=True)

__cmake = None

@property
def _cmake(self):
if self.__cmake is None:
self.__cmake = CMake(self)
return self.__cmake

def build(self):
self._cmake.configure()
self._cmake.build()

def package(self):
self._cmake.install()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use another template usually, I don't say this one is bad, but it's harder to maintain when there are several conventions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See 1d5defd

tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))

def package_info(self):
self.cpp_info.names["cmake_find_package"] = "Coz"
klimkin marked this conversation as resolved.
Show resolved Hide resolved
klimkin marked this conversation as resolved.
Show resolved Hide resolved
self.cpp_info.names["cmake_find_package_multi"] = "Coz"
klimkin marked this conversation as resolved.
Show resolved Hide resolved
if self.settings.os == "Linux":
self.cpp_info.system_libs = ["dl", "rt", "pthread"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private dependencies, so probably useless because coz is always shared, but it doesn't hurt I guess

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See 95b1852

8 changes: 8 additions & 0 deletions recipes/coz/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.1)
project(test_package C)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

add_executable(${PROJECT_NAME} test_package.c)
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
klimkin marked this conversation as resolved.
Show resolved Hide resolved
19 changes: 19 additions & 0 deletions recipes/coz/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from conans import ConanFile, CMake, tools
import os


class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"

def build(self):
cmake = CMake(self, build_type="RelWithDebInfo") # To work properly Coz tool requires debug information https://github.com/plasma-umass/coz
cmake.configure()
cmake.build()

def test(self):
if tools.cross_building(self.settings):
return
bin_path = os.path.join("bin", "test_package")
self.run("coz run --- " + bin_path, run_environment=True)
print(open("profile.coz").read())
11 changes: 11 additions & 0 deletions recipes/coz/all/test_package/test_package.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <coz.h>
#include <stdio.h>

int
main(int argc, char **argv)
{
COZ_PROGRESS_NAMED("something");
printf("Hello, Coz!\n");

return 0;
}
3 changes: 3 additions & 0 deletions recipes/coz/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"cci.20210322":
folder: "all"