summaryrefslogtreecommitdiff
path: root/vswitchd/system-stats.c
Commit message (Collapse)AuthorAgeFilesLines
* system-stats: Include core number in the process stats.Bhanuprakash Bodireddy2017-11-281-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | When dumping process statistics, include the the core number the process was last scheduled. With 'other_config:enable-statistics=true', Before: {cpu="28", file_systems="/,8474624,7826220 /workspace,223835956,199394160", load_average="1.29,1.76,1.33", memory="65861460,27457540,3813488,1999868,0", process_ovs-vswitchd="4685896,17452,362920,0,383967,383967", process_ovsdb-server="48088,5172,60,0,384057,384057"} After: {cpu="28", file_systems="/,8474624,7826308 /workspace,223835956,199394172", load_average="1.30,1.04,1.13", memory="65861460,27469176,3815252,1999868,0", process_ovs-vswitchd="4686020,17360,127380,0,148406,148406,3", process_ovsdb-server="48096,5212,30,0,148496,148496,4"} eg: process vsz , rss , cputime, crashes, booted, uptime, core_id ovs-vswitchd="4686020,17360, 127380, 0 , 148406, 148406, 3" Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* lib: Move lib/poll-loop.h to include/openvswitchXiao Liang2017-11-031-1/+1
| | | | | | | | Poll-loop is the core to implement main loop. It should be available in libopenvswitch. Signed-off-by: Xiao Liang <shaw.leon@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* process: Consolidate process related APIs.Bhanuprakash Bodireddy2017-07-131-250/+1
| | | | | | | | | | | | As part of retrieving system statistics, process status APIs along with helper functions were implemented. Some of them are very generic and can be reused by other subsystems. Move the APIs in system-stats.c to process.c and util.c and make them available. This patch doesn't change any functionality. Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* use portable getpagesize() in system-statsAlin Serdean2017-04-141-1/+1
| | | | | | | | Use the intended portable function defined above "get_page_size()" not "getpagesize()". Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* json: Move from lib to include/openvswitch.Terry Wilson2016-07-221-2/+2
| | | | | | | | | | | | | | | To easily allow both in- and out-of-tree building of the Python wrapper for the OVS JSON parser (e.g. w/ pip), move json.h to include/openvswitch. This also requires moving lib/{hmap,shash}.h. Both hmap.h and shash.h were #include-ing "util.h" even though the headers themselves did not use anything from there, but rather from include/openvswitch/util.h. Fixing that required including util.h in several C files mostly due to OVS_NOT_REACHED and things like xmalloc. Signed-off-by: Terry Wilson <twilson@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovs-thread: Do not quiesce in ovs_mutex_cond_wait().Daniele Di Proietto2016-05-231-0/+6
| | | | | | | | | | | | | | | ovs_mutex_cond_wait() is used in many functions in dpif-netdev to synchronize with pmd threads, but we can't guarantee that the callers do not hold RCU references, so it's better to avoid quiescing. In system_stats_thread_func() the code relied on ovs_mutex_cond_wait() to introduce a quiescent state, so explicit calls to ovsrcu_quiesce_start() and ovsrcu_quiesce_end() are added there. Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Tested-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Ben Pfaff <blp@ovn.org>
* Move lib/ofpbuf.h to include/openvswitch directoryBen Warren2016-03-301-1/+1
| | | | | | Signed-off-by: Ben Warren <ben@skyportsystems.com> Acked-by: Ryan Moats <rmoats@us.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Move lib/dynamic-string.h to include/openvswitch directoryBen Warren2016-03-191-1/+1
| | | | | Signed-off-by: Ben Warren <ben@skyportsystems.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* lib: Move vlog.h to <openvswitch/vlog.h>Thomas Graf2014-12-151-1/+1
| | | | | | | | A new function vlog_insert_module() is introduced to avoid using list_insert() from the vlog.h header. Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Ben Pfaff <blp@nicira.com>
* lib: Move compiler.h to <openvswitch/compiler.h>Thomas Graf2014-12-151-1/+1
| | | | | | | | | | The following macros are renamed to avoid conflicts with other headers: * WARN_UNUSED_RESULT to OVS_WARN_UNUSED_RESULT * PRINTF_FORMAT to OVS_PRINTF_FORMAT * NO_RETURN to OVS_NO_RETURN Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Ben Pfaff <blp@nicira.com>
* compiler: Define NO_RETURN for MSVC.Gurucharan Shetty2014-09-151-2/+2
| | | | | | | | | | | | | To prevent warnings such as "Not all control paths return a value", we should define NO_RETURN for MSVC. Currently for gcc, we add NO_RETURN at the end of function declaration. But for MSVC, "__declspec(noreturn)" is needed at the beginning of function declaration. So this commit moves NO_RETURN to the beginning of the function declaration as it works with gcc and clang too. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* ovs-thread: Make caller provide thread name when creating a thread.Ben Pfaff2014-04-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Thread names are occasionally very useful for debugging, but from time to time we've forgotten to set one. This commit adds the new thread's name as a parameter to the function to start a thread, to make that mistake impossible. This also simplifies code, since two function calls become only one. This makes a few other changes to the thread creation function: * Since it is no longer a direct wrapper around a pthread function, rename it to avoid giving that impression. * Remove 'pthread_attr_t *' param that every caller supplied as NULL. * Change 'pthread *' parameter into a return value, for convenience. The system-stats code hadn't set a thread name, so this fixes that issue. This patch is a prerequisite for making RCU report the name of a thread that is blocking RCU synchronization, because the easiest way to do that is for ovsrcu_quiesce_end() to record the current thread's name. ovsrcu_quiesce_end() is called before the thread function is called, so it won't get a name set within the thread function itself. Setting the thread name earlier, as in this patch, avoids the problem. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Alex Wang <alexw@nicira.com>
* system-stats: Port for Windows.Gurucharan Shetty2014-03-171-0/+17
| | | | | | | | This does not provide us all the functionality that is available in Linux. But should be a start. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* Use __linux__ instead of LINUX_DATAPATH in C code.Ben Pfaff2014-03-051-12/+13
| | | | | | | | | | | The LINUX_DATAPATH C preprocessor symbol was originally meant to be used as a signal for whether the Linux datapath module could be used, but it was used as a proxy for a lot of other stuff that is really just Linux specific. This commit switches all of these users to just test for __linux__, which is more straightforward and should have the same result. CC: Luigi Rizzo <rizzo@iet.unipi.it> Signed-off-by: Ben Pfaff <blp@nicira.com>
* lib: Refactor gathering CPU core countJoe Stringer2013-12-091-1/+1
| | | | | | Signed-off-by: Joe Stringer <joestringer@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* Switch from sscanf() to ovs_scan() throughout the tree.Ben Pfaff2013-11-151-3/+3
| | | | Signed-off-by: Ben Pfaff <blp@nicira.com>
* Use "error-checking" mutexes in place of other kinds wherever possible.Ben Pfaff2013-08-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | We've seen a number of deadlocks in the tree since thread safety was introduced. So far, all of these are self-deadlocks, that is, a single thread acquiring a lock and then attempting to re-acquire the same lock recursively. When this has happened, the process simply hung, and it was somewhat difficult to find the cause. POSIX "error-checking" mutexes check for this specific problem (and others). This commit switches from other types of mutexes to error-checking mutexes everywhere that we can, that is, everywhere that we're not using recursive mutexes. This ought to help find problems more quickly in the future. There might be performance advantages to other kinds of mutexes in some cases. However, the existing mutex type choices were just guesses, so I'd rather go for easy detection of errors until we know that other mutex types actually perform better in specific cases. Also, I did a quick microbenchmark of glibc mutex types on my host and found that the error checking mutexes weren't any slower than the other types, at least when the mutex is uncontended. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* clang: Pass objects, not their addresses, to thread-safety macros.Alex Wang2013-08-091-1/+1
| | | | | | | | This commit changes the code such that arguments to thread-safety macros are not ampersanded. Signed-off-by: Alex Wang <alexw@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* clang: Add annotations for thread safety check.Ethan Jackson2013-07-301-14/+14
| | | | | | | | | | This commit adds annotations for thread safety check. And the check can be conducted by using -Wthread-safety flag in clang. Co-authored-by: Alex Wang <alexw@nicira.com> Signed-off-by: Alex Wang <alexw@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* system-stats: Move into separate thread.Ben Pfaff2013-07-181-21/+85
| | | | Signed-off-by: Ben Pfaff <blp@nicira.com>
* system-stats: Remove worker process support.Ben Pfaff2013-07-121-121/+24
| | | | | | | | The worker process implementation isn't thread-safe and, once OVS itself is threaded, it doesn't make much sense to have a worker process anyway. Signed-off-by: Ben Pfaff <blp@nicira.com>
* Replace all uses of strerror() by ovs_strerror(), for thread safety.Ben Pfaff2013-06-281-8/+12
| | | | Signed-off-by: Ben Pfaff <blp@nicira.com>
* system-stats: Use getmntent_r() for thread-safety.Ben Pfaff2013-05-031-3/+5
| | | | | | | | getmntent_r() is a GNU extension so we test for its existence and just disable this feature of system stats if it is not present, because this feature is not very important. Signed-off-by: Ben Pfaff <blp@nicira.com>
* be compilable even when _SC_PHYS_PAGES is not availableYAMAMOTO Takashi2013-04-221-0/+4
| | | | | Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Replace most uses of assert by ovs_assert.Ben Pfaff2013-01-161-7/+6
| | | | | | | | This is a straight search-and-replace, except that I also removed #include <assert.h> from each file where there were no assert calls left. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* config: Add explicit support for building on ESX.Ethan Jackson2012-10-091-12/+11
| | | | | | | | | | | | | The ESX userspace looks quite a bit like linux, but has some key differences which need to be specially handled in the build. To distinguish between ESX and systems which use the linux datapath module, this patch adds two new macros "ESX" and "LINUX_DATAPATH". It uses these macros to disable building code on ESX which only applies to a true Linux environment. In addition, it adds a new route-table-stub implementation which is required for the build to complete successfully on ESX. Signed-off-by: Ethan Jackson <ethan@nicira.com>
* system-stats: Run as part of worker process.Ben Pfaff2012-07-181-6/+152
| | | | | | | The stats gathering can be time-consuming in some cases, so it's better to do it in the worker process. Signed-off-by: Ben Pfaff <blp@nicira.com>
* system-stats: Use "smap" instead of "shash".Ben Pfaff2012-07-181-31/+27
| | | | | | | | | "smap" is now the appropriate data structure for a string-to-string map. Also changes ovsdb_datum_from_shash() into ovsdb_datum_from_smap() since system-stats related code was the only client. Signed-off-by: Ben Pfaff <blp@nicira.com>
* Global replace of Nicira Networks.Raju Subramanian2012-05-021-1/+1
| | | | | | | | Replaced all instances of Nicira Networks(, Inc) to Nicira, Inc. Feature #10593 Signed-off-by: Raju Subramanian <rsubramanian@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Fix build on FreeBSD.Edward Tomasz NapieraƂa2011-11-011-0/+4
| | | | | | | Patch below fixes build on FreeBSD; tested on 10.0-CURRENT. Signed-off-by: Edward Tomasz Napierala <trasz@FreeBSD.org> Signed-off-by: Ben Pfaff <blp@nicira.com>
* system-stats: Don't bother calling kill() after read_pidfile().Justin Pettit2011-03-131-2/+1
| | | | | | | The function read_pidfile() will only return a PID if the process is still running, so there's no reason to send a signal to check again. Suggested-by: Andrew Evans <aevans@nicira.com>
* Make installation directories overridable at runtime.Ben Pfaff2010-11-291-3/+3
| | | | | | | | | This makes it possible to run tests that need access to installation directories, such as the rundir, without having access to the actual installation directories (/var/run is generally not world-writable), by setting environment variables. This is not a good way to do things in general--usually it would be better to choose the correct directories at configure time--so for now this is undocumented.
* vlog: Make client supply semicolon for VLOG_DEFINE_THIS_MODULE.Ben Pfaff2010-10-291-1/+1
| | | | | It's kind of odd for VLOG_DEFINE_THIS_MODULE to supply its own semicolon, so this commit switches to the more common form.
* ovs-vswitchd: Export system stats through Open_vSwitch table.Ben Pfaff2010-09-231-0/+503
This is intended to provide controllers enough information to determine whether a switch is overloaded or busted, to enable them to spread load fairly across a group of switches. Feature #2421. CC: Peter Balland <peter@nicira.com>