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

Energy API #2

Open
beltex opened this issue Oct 24, 2014 · 5 comments
Open

Energy API #2

beltex opened this issue Oct 24, 2014 · 5 comments

Comments

@beltex
Copy link
Owner

beltex commented Oct 24, 2014

  • As seen in Activity Monitor
  • Seems to be a custom calculation, no API for it
  • Maybe something in IOPMLib
@beltex
Copy link
Owner Author

beltex commented Nov 2, 2014

Goodies via class-dump on Activity Monitor:

    NSNumberFormatter *_powerScoreFormatter;
    NSNumber *_combinedPowerScore;
    NSNumber *_combinedAveragePowerScore;
    NSNumber *_averagePowerScore;
    NSNumber *_powerScore;
    NSNumber *_totalPowerScore;
    NSString *_combinedPowerScoreDescription;
    NSString *_combinedAveragePowerScoreDescription;
    NSString *_powerScoreDescription;
    NSString *_averagePowerScoreDescription;
@property(retain) NSString *averagePowerScoreDescription; // @synthesize averagePowerScoreDescription=_averagePowerScoreDescription;
@property(retain) NSString *powerScoreDescription; // @synthesize powerScoreDescription=_powerScoreDescription;
@property(retain) NSString *combinedAveragePowerScoreDescription; // @synthesize combinedAveragePowerScoreDescription=_combinedAveragePowerScoreDescription;
@property(retain) NSString *combinedPowerScoreDescription; // @synthesize combinedPowerScoreDescription=_combinedPowerScoreDescription;
@property(retain) NSNumber *totalPowerScore; // @synthesize totalPowerScore=_totalPowerScore;
@property(retain) NSNumber *powerScore; // @synthesize powerScore=_powerScore;
@property(retain) NSNumber *averagePowerScore; // @synthesize averagePowerScore=_averagePowerScore;
@property(retain) NSNumber *combinedAveragePowerScore; // @dynamic combinedAveragePowerScore;
@property(retain) NSNumber *combinedPowerScore; // @dynamic combinedPowerScore;
- (id)initWithName:(id)arg1 powerScore:(id)arg2 icon:(id)arg3 bundeIdentifier:(id)arg4;

Next - try DTrace & LLDB/GDB.

@beltex
Copy link
Owner Author

beltex commented Nov 5, 2014

Looks like top (which is open source) actually has this stat already, didn't notice it. :)

@beltex
Copy link
Owner Author

beltex commented Nov 5, 2014

Also, pre-req for this is #10.

@beltex beltex added this to the 0.0.1 milestone Dec 5, 2014
@beltex
Copy link
Owner Author

beltex commented Dec 7, 2014

These don't seem to be used by top. Will try them out. In <mach/task_info.h>

#define TASK_POWER_INFO_V2  26

typedef struct {
    uint64_t        task_gpu_utilisation;
    uint64_t        task_gpu_stat_reserved0;
    uint64_t        task_gpu_stat_reserved1;
    uint64_t        task_gpu_stat_reserved2;
} gpu_energy_data;

typedef gpu_energy_data *gpu_energy_data_t;
struct task_power_info_v2 {
    task_power_info_data_t  cpu_energy;
    gpu_energy_data gpu_energy;
};

typedef struct task_power_info_v2   task_power_info_v2_data_t;
typedef struct task_power_info_v2   *task_power_info_v2_t;
#define TASK_POWER_INFO_V2_COUNT    ((mach_msg_type_number_t) \
        (sizeof (task_power_info_v2_data_t) / sizeof (natural_t)))

@beltex beltex removed this from the 0.0.1 milestone Jan 10, 2015
@beltex
Copy link
Owner Author

beltex commented Jan 11, 2015

TASK_POWER_INFO_V2 didn't return any GPU data. Probably because my machine is old, newer graphics card needed, likely a discrete one - MacBook Pro 15+ & Mac Pro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant