···11+/*
22+ * Darling - pmenergy & pmsample stub
33+ * Copyright (c) 2018 Lubos Dolezel, All rights reserved.
44+ *
55+ * This library is free software; you can redistribute it and/or
66+ * modify it under the terms of the GNU Lesser General Public
77+ * License as published by the Free Software Foundation; either
88+ * version 3.0 of the License, or (at your option) any later version.
99+ *
1010+ * This library is distributed in the hope that it will be useful,
1111+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1212+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1313+ * Lesser General Public License for more details.
1414+ *
1515+ * You should have received a copy of the GNU Lesser General Public
1616+ * License along with this library.
1717+ */
1818+1919+#ifndef _PMENERGY_H
2020+#define _PMENERGY_H
2121+#include <stdint.h>
2222+2323+#ifdef __cplusplus
2424+extern "C" {
2525+#endif
2626+2727+struct pm_task_energy_data
2828+{
2929+ struct
3030+ {
3131+ uint64_t total_user, total_system, task_interrupt_wakeups, task_platform_idle_wakeups;
3232+ } sti;
3333+3434+ uint64_t diskio_bytesread, diskio_byteswritten, pageins;
3535+};
3636+3737+typedef struct pm_task_energy_data pm_task_energy_data_t;
3838+3939+uint64_t pm_energy_impact(const pm_task_energy_data_t* pme);
4040+4141+#ifdef __cplusplus
4242+}
4343+#endif
4444+4545+#endif
4646+
+45
src/libpmenergy/include/pmsample.h
···11+/*
22+ * Darling - pmenergy & pmsample stub
33+ * Copyright (c) 2018 Lubos Dolezel, All rights reserved.
44+ *
55+ * This library is free software; you can redistribute it and/or
66+ * modify it under the terms of the GNU Lesser General Public
77+ * License as published by the Free Software Foundation; either
88+ * version 3.0 of the License, or (at your option) any later version.
99+ *
1010+ * This library is distributed in the hope that it will be useful,
1111+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1212+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1313+ * Lesser General Public License for more details.
1414+ *
1515+ * You should have received a copy of the GNU Lesser General Public
1616+ * License along with this library.
1717+ */
1818+1919+#ifndef _PMSAMPLE_H
2020+#define _PMSAMPLE_H
2121+2222+#include <stdint.h>
2323+#include <pmenergy.h>
2424+#include <mach/mach.h>
2525+#include <unistd.h>
2626+2727+#ifdef __cplusplus
2828+extern "C" {
2929+#endif
3030+3131+// These constants are made up!!!
3232+#define PM_SAMPLE_ALL 0xffffffff
3333+#define PM_SAMPLE_NAME 1
3434+#define PM_SAMPLE_INTERVAL 2
3535+#define PM_SAMPLE_CPU 4
3636+#define PM_SAMPLE_DISK 8
3737+3838+int pm_sample_task_and_pid(task_t task, pid_t pid, pm_task_energy_data_t* pme, uint64_t mach_time, unsigned int flags);
3939+4040+#ifdef __cplusplus
4141+}
4242+#endif
4343+4444+#endif
4545+
+25
src/libpmenergy/src/pmenergy.c
···11+/*
22+ * Darling - pmenergy & pmsample stub
33+ * Copyright (c) 2018 Lubos Dolezel, All rights reserved.
44+ *
55+ * This library is free software; you can redistribute it and/or
66+ * modify it under the terms of the GNU Lesser General Public
77+ * License as published by the Free Software Foundation; either
88+ * version 3.0 of the License, or (at your option) any later version.
99+ *
1010+ * This library is distributed in the hope that it will be useful,
1111+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1212+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1313+ * Lesser General Public License for more details.
1414+ *
1515+ * You should have received a copy of the GNU Lesser General Public
1616+ * License along with this library.
1717+ */
1818+1919+#include "pmenergy.h"
2020+2121+uint64_t pm_energy_impact(const pm_task_energy_data_t* pme)
2222+{
2323+ return 0;
2424+}
2525+
+25
src/libpmenergy/src/pmsample.c
···11+/*
22+ * Darling - pmenergy & pmsample stub
33+ * Copyright (c) 2018 Lubos Dolezel, All rights reserved.
44+ *
55+ * This library is free software; you can redistribute it and/or
66+ * modify it under the terms of the GNU Lesser General Public
77+ * License as published by the Free Software Foundation; either
88+ * version 3.0 of the License, or (at your option) any later version.
99+ *
1010+ * This library is distributed in the hope that it will be useful,
1111+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1212+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1313+ * Lesser General Public License for more details.
1414+ *
1515+ * You should have received a copy of the GNU Lesser General Public
1616+ * License along with this library.
1717+ */
1818+1919+#include "pmsample.h"
2020+2121+int pm_sample_task_and_pid(task_t task, pid_t pid, pm_task_energy_data_t* pme, uint64_t mach_time, unsigned int flags)
2222+{
2323+ return 0;
2424+}
2525+