2 * Copyright (c) 2012 Nicira, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 /* Memory usage monitor.
22 * This is intended to be called as part of a daemon's main loop. After some
23 * time to allow the daemon to allocate an initial memory usage, it logs some
24 * memory usage information (most of which must actually be provided by the
25 * client). At intervals, if the daemon's memory usage has grown
26 * significantly, it again logs information.
28 * The monitor also has a unixctl interface.
30 * Intended usage in the program's main loop is like this:
34 * if (memory_should_report()) {
38 * ...fill in 'usage' with meaningful statistics...
39 * memory_report(&usage);
40 * simap_destroy(&usage);
54 void memory_run(void);
55 void memory_wait(void);
57 bool memory_should_report(void);
58 void memory_report(const struct simap *usage);