-
-
Notifications
You must be signed in to change notification settings - Fork 622
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
Conky for mac os master #579
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@npyl one minor code nit pick. Otherwise, everything looks great.
src/core.cc
Outdated
@@ -121,6 +121,12 @@ | |||
#include "darwin.h" | |||
#endif | |||
|
|||
#if defined (__APPLE__) && defined (__MACH__) | |||
#define DARWIN_DEALLOCATE_CPU_SAMPLE obj->callbacks.free = &deallocate_cpu_sample; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nit pick, but can you change this to a function instead of a macro? We have too many crazy C macros.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please give me an example because I am not sure how this would work? If I understand correct, you want me to introduce a general function e.g. deallocate_cpu
but this would mean that all OS-specific files (linux.cc, freebsd.cc, etc) should introduce this function, too!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes precisely, an OS-dependent function (like deallocate_cpu
) which can be set as the free
callback, like this:
Lines 579 to 582 in 4d5db32
END OBJ_ARG(disk_protect, 0, "disk_protect needs an argument") obj->data.s = | |
strndup(dev_name(arg), text_buffer_size.get(*state)); | |
obj->callbacks.print = &print_disk_protect_queue; | |
obj->callbacks.free = &gen_free_opaque; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function can just be a no-op on other platforms btw.
This is mostly about establishing better practices/patterns. I try to make sure everything continually improves :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok! I am on it now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brndnmtthws I got it! 😉
d7553dc
to
1150ddf
Compare
src/darwin.mm
Outdated
@@ -286,7 +286,7 @@ void allocate_cpu_sample(struct cpusample **sample) { | |||
sample_handle = *sample; /* use a public handle for deallocating */ | |||
} | |||
|
|||
void deallocate_cpu_sample(struct text_object *obj) { | |||
void free_cpu(struct text_object *) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brilliant, thanks!
Keep BUILD_WLAN OFF by default for compatibility reasons.
There are some problems (probably null-dereference)
Conky wasn't parsing the argument of the variable as it should, thus wasn't allocating the `dev` member variable. Also fix some documentation stuff.
Using the Intel® Power Gadget API (https://software.intel.com/en-us/blogs/2012/12/13/using-the-intel-power-gadget-api-on-mac-os-x) we can now get actual Core frequency and not the constant factory one. Though, for some weird reason the API gives the same freq for all Cores, thus the |cpu| arg becomes useless.
This build option has been introduced for one particular reason: On macOS getting current core-frequency is not supported by the APIs. A solution is to install Intel's ® Power Gadget which comes with an .app, a Framework and a kernel-extension. Though, this may trouble some alot, thus introduce BUILD_IPGFREQ.
Fix frequency not printing correctly (I wasn't using the divisor) Add more guards.
We want to use CoreWLAN framework.
Also, some cleanup.
…elated variables free_cpu() must be implemented for every OS and on all except macOS its a no-op function.
b417f59
to
d9b218b
Compare
Sorry, I made a mess of the PR. I think we are good to go now though. |
* Try to amend #31 * BUILD_WLAN should be available for all OS. Keep BUILD_WLAN OFF by default for compatibility reasons. * WLAN-related variables should be available for every OS. There are some problems (probably null-dereference) * Fix $wireless_essid crashing conky if no argument provided. Conky wasn't parsing the argument of the variable as it should, thus wasn't allocating the `dev` member variable. Also fix some documentation stuff. * Improve `get_freq` #20 Using the Intel® Power Gadget API (https://software.intel.com/en-us/blogs/2012/12/13/using-the-intel-power-gadget-api-on-mac-os-x) we can now get actual Core frequency and not the constant factory one. Though, for some weird reason the API gives the same freq for all Cores, thus the |cpu| arg becomes useless. * Oops, this accidently slipped in * Introduce BUILD_IPGFREQ build option This build option has been introduced for one particular reason: On macOS getting current core-frequency is not supported by the APIs. A solution is to install Intel's ® Power Gadget which comes with an .app, a Framework and a kernel-extension. Though, this may trouble some alot, thus introduce BUILD_IPGFREQ. * Forgot static here. * Some improvements for get_freq again. Fix frequency not printing correctly (I wasn't using the divisor) Add more guards. * Setup cmake files and project code for Objective-C code #17 We want to use CoreWLAN framework. * update_cpu_usage() now supports multiple cores Also, some cleanup. * Updated default conky config to monitor Mac Networking * Made Mac Friendly BuildOptions and generic default conky configs * Undid Xdamage config and cleaned up previous IF statements * Re-Added XDamage fix * Finish up the algorithm. I think its now correct. Closes: #33 * Cleanup macro and introduce a no-op free_cpu() function for ALL cpu-related variables free_cpu() must be implemented for every OS and on all except macOS its a no-op function. * Reformat, add empty comment.
No description provided.