2012-12-05 15:12:20 +00:00
|
|
|
#ifndef HEADER_Affinity
|
|
|
|
#define HEADER_Affinity
|
|
|
|
/*
|
|
|
|
htop - Affinity.h
|
|
|
|
(C) 2004-2011 Hisham H. Muhammad
|
2020-08-20 09:35:24 +10:00
|
|
|
(C) 2020 Red Hat, Inc. All Rights Reserved.
|
2020-10-05 09:51:32 +02:00
|
|
|
Released under the GNU GPLv2, see the COPYING file
|
2012-12-05 15:12:20 +00:00
|
|
|
in the source distribution for its full text.
|
|
|
|
*/
|
|
|
|
|
2020-11-18 15:12:18 +01:00
|
|
|
#include "config.h" // IWYU pragma: keep
|
2020-09-19 13:55:23 +02:00
|
|
|
|
2020-11-18 15:12:18 +01:00
|
|
|
#include "ProcessList.h"
|
|
|
|
|
|
|
|
#if defined(HAVE_LIBHWLOC) || defined(HAVE_LINUX_AFFINITY)
|
2020-09-19 13:55:23 +02:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
#include "Object.h"
|
2015-01-21 23:27:31 -02:00
|
|
|
#include "Process.h"
|
2020-11-18 15:12:18 +01:00
|
|
|
#endif
|
|
|
|
|
2012-12-05 15:12:20 +00:00
|
|
|
|
2020-09-08 16:25:22 +02:00
|
|
|
#if defined(HAVE_LIBHWLOC) && defined(HAVE_LINUX_AFFINITY)
|
2020-11-18 15:12:18 +01:00
|
|
|
#error hwloc and linux affinity are mutual exclusive.
|
2020-09-08 16:25:22 +02:00
|
|
|
#endif
|
|
|
|
|
2020-11-18 15:12:18 +01:00
|
|
|
|
2012-12-05 15:12:20 +00:00
|
|
|
typedef struct Affinity_ {
|
2015-01-21 23:27:31 -02:00
|
|
|
ProcessList* pl;
|
2012-12-05 15:12:20 +00:00
|
|
|
int size;
|
|
|
|
int used;
|
|
|
|
int* cpus;
|
|
|
|
} Affinity;
|
|
|
|
|
2020-09-02 02:38:44 -05:00
|
|
|
Affinity* Affinity_new(ProcessList* pl);
|
2012-12-05 15:12:20 +00:00
|
|
|
|
2020-09-02 02:38:44 -05:00
|
|
|
void Affinity_delete(Affinity* this);
|
2012-12-05 15:12:20 +00:00
|
|
|
|
2020-09-02 02:38:44 -05:00
|
|
|
void Affinity_add(Affinity* this, int id);
|
2012-12-05 15:12:20 +00:00
|
|
|
|
2020-09-12 19:18:23 -03:00
|
|
|
#if defined(HAVE_LIBHWLOC) || defined(HAVE_LINUX_AFFINITY)
|
2015-01-21 23:27:31 -02:00
|
|
|
|
2020-09-02 02:38:44 -05:00
|
|
|
Affinity* Affinity_get(Process* proc, ProcessList* pl);
|
2015-01-21 23:27:31 -02:00
|
|
|
|
2020-09-02 02:38:44 -05:00
|
|
|
bool Affinity_set(Process* proc, Arg arg);
|
2015-01-21 23:27:31 -02:00
|
|
|
|
2020-11-18 15:12:18 +01:00
|
|
|
#endif /* HAVE_LIBHWLOC || HAVE_LINUX_AFFINITY */
|
2012-12-05 15:12:20 +00:00
|
|
|
|
|
|
|
#endif
|