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-19 23:35:24 +00:00
|
|
|
(C) 2020 Red Hat, Inc. All Rights Reserved.
|
2020-10-05 07:51:32 +00: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 14:12:18 +00:00
|
|
|
#include "config.h" // IWYU pragma: keep
|
2020-09-19 11:55:23 +00:00
|
|
|
|
2020-11-18 14:12:18 +00:00
|
|
|
#include "ProcessList.h"
|
|
|
|
|
|
|
|
#if defined(HAVE_LIBHWLOC) || defined(HAVE_LINUX_AFFINITY)
|
2020-09-19 11:55:23 +00:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
#include "Object.h"
|
2015-01-22 01:27:31 +00:00
|
|
|
#include "Process.h"
|
2020-11-18 14:12:18 +00:00
|
|
|
#endif
|
|
|
|
|
2012-12-05 15:12:20 +00:00
|
|
|
|
2020-09-08 14:25:22 +00:00
|
|
|
#if defined(HAVE_LIBHWLOC) && defined(HAVE_LINUX_AFFINITY)
|
2020-11-18 14:12:18 +00:00
|
|
|
#error hwloc and linux affinity are mutual exclusive.
|
2020-09-08 14:25:22 +00:00
|
|
|
#endif
|
|
|
|
|
2020-11-18 14:12:18 +00:00
|
|
|
|
2012-12-05 15:12:20 +00:00
|
|
|
typedef struct Affinity_ {
|
2015-01-22 01:27:31 +00:00
|
|
|
ProcessList* pl;
|
2021-02-17 16:38:35 +00:00
|
|
|
unsigned int size;
|
|
|
|
unsigned int used;
|
|
|
|
unsigned int* cpus;
|
2012-12-05 15:12:20 +00:00
|
|
|
} Affinity;
|
|
|
|
|
2020-09-02 07:38:44 +00:00
|
|
|
Affinity* Affinity_new(ProcessList* pl);
|
2012-12-05 15:12:20 +00:00
|
|
|
|
2020-09-02 07:38:44 +00:00
|
|
|
void Affinity_delete(Affinity* this);
|
2012-12-05 15:12:20 +00:00
|
|
|
|
2021-02-17 16:38:35 +00:00
|
|
|
void Affinity_add(Affinity* this, unsigned int id);
|
2012-12-05 15:12:20 +00:00
|
|
|
|
2020-09-12 22:18:23 +00:00
|
|
|
#if defined(HAVE_LIBHWLOC) || defined(HAVE_LINUX_AFFINITY)
|
2015-01-22 01:27:31 +00:00
|
|
|
|
2021-01-05 22:42:55 +00:00
|
|
|
Affinity* Affinity_get(const Process* proc, ProcessList* pl);
|
2015-01-22 01:27:31 +00:00
|
|
|
|
2020-09-02 07:38:44 +00:00
|
|
|
bool Affinity_set(Process* proc, Arg arg);
|
2015-01-22 01:27:31 +00:00
|
|
|
|
2020-11-18 14:12:18 +00:00
|
|
|
#endif /* HAVE_LIBHWLOC || HAVE_LINUX_AFFINITY */
|
2012-12-05 15:12:20 +00:00
|
|
|
|
|
|
|
#endif
|