| 1 |
/* |
| 2 |
* Copyright © 2016 Canonical Ltd. |
| 3 |
* |
| 4 |
* This program is free software: you can redistribute it and/or modify it |
| 5 |
* under the terms of the GNU General Public License version 3, as published |
| 6 |
* by the Free Software Foundation. |
| 7 |
* |
| 8 |
* This program is distributed in the hope that it will be useful, but |
| 9 |
* WITHOUT ANY WARRANTY; without even the implied warranties of |
| 10 |
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 11 |
* PURPOSE. See the GNU General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU General Public License along |
| 14 |
* with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
* |
| 16 |
* Authors: |
| 17 |
* Ted Gould <[email protected]> |
| 18 |
*/ |
| 19 |
|
| 20 |
#pragma once |
| 21 |
#pragma GCC visibility push(default) |
| 22 |
|
| 23 |
#include <cstdint> |
| 24 |
|
| 25 |
namespace lomiri |
| 26 |
{ |
| 27 |
namespace app_launch |
| 28 |
{ |
| 29 |
namespace oom |
| 30 |
{ |
| 31 |
|
| 32 |
enum class Score : std::int32_t; |
| 33 |
|
| 34 |
/** Get the OOM Score that should be associated with an application that |
| 35 |
is focused. */ |
| 36 |
Score focused(); |
| 37 |
/** Get the OOM Score that should be associated with an application that |
| 38 |
is pause. */ |
| 39 |
Score paused(); |
| 40 |
/** Create a new OOM Score value with a label for debugging messages. This |
| 41 |
function will throw a warning if the value isn't between focused() and |
| 42 |
paused(). An exception will be thrown if it isn't between -1000 and 1000. |
| 43 |
|
| 44 |
\warning This function should only be used for prototyping, the behavior |
| 45 |
of what causes exceptions or warning may change in the future. |
| 46 |
|
| 47 |
\param value A value between -1000 and 1000 to pass to the kernel's oom_adjust |
| 48 |
\param label The name of this state for debugging |
| 49 |
*/ |
| 50 |
Score fromLabelAndValue(std::int32_t value, const std::string& label); |
| 51 |
|
| 52 |
} // namespace oom |
| 53 |
} // namespace app_launch |
| 54 |
} // namespace lomiri |
| 55 |
|
| 56 |
#pragma GCC visibility pop |