/* * This file is part of Xfce (https://gitlab.xfce.org). * * zram monitor: local addition, not part of upstream. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES * ARE DISCLAIMED. */ #ifndef _XFCE_SYSTEMLOAD_ZRAM_H_ #define _XFCE_SYSTEMLOAD_ZRAM_H_ #include /* * Physical RAM occupied by all zram devices, in kB. * Returns 0 when there is no zram device or the data cannot be read. * * This is the number that has to be subtracted from "used memory": pages held * by zram are counted as used RAM, yet they are not memory of any process - * they are the compressed backing store of the swap. */ gulong read_zram_phys (void); /* * zram summary across all devices. * * zram - physical footprint as a percentage of MemTotal (for the bar) * phys_kb - physical RAM used, kB (mem_used_total from mm_stat) * stored_kb - uncompressed size of the stored pages, kB (orig_data_size) * ratio - stored/compressed, 0.0 when nothing is stored * * Returns 0 on success, -1 when there is no zram device. */ gint read_zram (gulong *zram, gulong *phys_kb, gulong *stored_kb, gdouble *ratio); /* * Swap totals EXCLUDING zram devices, in kB, read from /proc/swaps. * * SwapTotal/SwapFree in /proc/meminfo lump zram together with disk swap, and * for zram they report the uncompressed size - a number that corresponds to * nothing physical. The real question the swap bar should answer is "how much * has spilled onto the disk", and that is what this returns. * * Returns 0 on success, -1 when /proc/swaps cannot be read. */ gint read_disk_swap (gulong *total_kb, gulong *used_kb); #endif /* _XFCE_SYSTEMLOAD_ZRAM_H_ */