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

compile pcm-sensor-server on OSX #613

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ endif()
if(UNIX) # LINUX, FREE_BSD, APPLE
if (NOT APPLE)
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS} -s") # --strip-unneeded for packaging
list(APPEND PROJECT_NAMES pcm-sensor-server)
endif()
list(APPEND PROJECT_NAMES pcm-sensor-server)
list(APPEND PROJECT_NAMES pcm-sensor)

# libpcm.a
Expand Down
7 changes: 6 additions & 1 deletion src/cpucounters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,12 @@ void PCM::printSystemTopology() const

bool PCM::initMSR()
{
#ifndef __APPLE__
#ifdef __APPLE__
for (size_t i=0; i < MSR.size(); ++i)
{
systemTopology->addMSRHandleToOSThread(MSR[i], (uint32)i);
}
#else
try
{
for (int i = 0; i < (int)num_cores; ++i)
Expand Down
8 changes: 8 additions & 0 deletions src/pcm-sensor-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3181,7 +3181,9 @@ void printHelpText( std::string const & programName ) {
std::cout << " -p portnumber : Run on port <portnumber> (default port is " << DEFAULT_HTTP_PORT << ")\n";
std::cout << " -r|--reset : Reset programming of the performance counters.\n";
std::cout << " -D|--debug level : level = 0: no debug info, > 0 increase verbosity.\n";
#ifndef __APPLE__
std::cout << " -R|--real-time : If possible the daemon will run with real time\n";
#endif
std::cout << " priority, could be useful under heavy load to \n";
std::cout << " stabilize the async counter fetching.\n";
#if defined (USE_SSL)
Expand Down Expand Up @@ -3209,7 +3211,9 @@ int mainThrows(int argc, char * argv[]) {
bool useSSL = false;
#endif
bool forcedProgramming = false;
#ifndef __APPLE__
bool useRealtimePriority = false;
#endif
bool forceRTMAbortMode = false;
unsigned short port = 0;
unsigned short debug_level = 0;
Expand Down Expand Up @@ -3270,10 +3274,12 @@ int mainThrows(int argc, char * argv[]) {
throw std::runtime_error( "main: Error no debug level argument given" );
}
}
#ifndef __APPLE__
else if ( check_argument_equals( argv[i], {"-R", "--real-time"} ) )
{
useRealtimePriority = true;
}
#endif
else if ( check_argument_equals( argv[i], {"--help", "-h", "/h"} ) )
{
printHelpText( argv[0] );
Expand Down Expand Up @@ -3397,6 +3403,7 @@ int mainThrows(int argc, char * argv[]) {
}
#endif

#ifndef __APPLE__
if ( useRealtimePriority ) {
int priority = sched_get_priority_min( SCHED_RR );
if ( priority == -1 ) {
Expand All @@ -3414,6 +3421,7 @@ int mainThrows(int argc, char * argv[]) {
}
}
}
#endif

pid_t pid;
if ( daemonMode )
Expand Down