Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ matrix:
deploy:
provider: releases
api_key:
secure: "EbM5FzcjE5waVpl0fl3J/rorE3UbhbX+gyhbjIv35GqHU5Ifwo5oMo2xno8G8y83PTzVFvpF9n/AWxRtKUEB2j5gtK1uljBheeBHmXIs6G7LdBZPq2bexPRpO2N7GgS1huWd8Z8YSwsoxC5/OR/hwIU1KgEY/ol2q15XiZLsl4c="
secure: "kElMZA2rpuSswHZuQuFZYdOllg5b+cOcid+Ac8RZJlqM+EPi+5cDuNWGmqxNka9lvLwwB+Mq37+t9J1PSHuTf/WNcDeI82h//Prll6jP5aHuxrIZA6UTeqTAzhmVGHbcjorvROp5O2MeyJMHtyi3gi9XOf8OlfSLpO4pM37Ad1w="
file: haskell/sbp_linux_tools.tar.gz
skip_cleanup: true
on:
Expand Down
147 changes: 147 additions & 0 deletions c/include/libsbp/linux.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
/*
* Copyright (C) 2015-2018 Swift Navigation Inc.
* Contact: Swift Navigation <dev@swiftnav.com>
*
* This source is subject to the license found in the file 'LICENSE' which must
* be be distributed together with this source. All other rights reserved.
*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
*/

/*****************************************************************************
* Automatically generated from yaml/swiftnav/sbp/linux.yaml
* with generate.py. Please do not hand edit!
*****************************************************************************/

/** \defgroup linux Linux
*
* * Linux state monitoring.
* \{ */

#ifndef LIBSBP_LINUX_MESSAGES_H
#define LIBSBP_LINUX_MESSAGES_H

#include "common.h"

SBP_PACK_START


/** List CPU state on the system
*
* This message indicates the process state of the top 10 heaviest
* consumers of CPU on the system.
*/
#define SBP_MSG_LINUX_CPU_STATE 0x7F00
typedef struct SBP_ATTR_PACKED {
u8 index; /**< sequence of this status message, values from 0-9 */
u16 pid; /**< the PID of the process */
u8 pcpu; /**< percent of cpu used, expressed as a fraction of 256 */
char tname[15]; /**< fixed length string representing the thread name */
char cmdline[0]; /**< the command line (as much as it fits in the remaining packet) */
} msg_linux_cpu_state_t;


/** List CPU state on the system
*
* This message indicates the process state of the top 10 heaviest
* consumers of memory on the system.
*/
#define SBP_MSG_LINUX_MEM_STATE 0x7F01
typedef struct SBP_ATTR_PACKED {
u8 index; /**< sequence of this status message, values from 0-9 */
u16 pid; /**< the PID of the process */
u8 pmem; /**< percent of memory used, expressed as a fraction of 256 */
char tname[15]; /**< fixed length string representing the thread name */
char cmdline[0]; /**< the command line (as much as it fits in the remaining packet) */
} msg_linux_mem_state_t;


/** CPU, Memory and Process Starts/Stops
*
* This presents a summary of CPU and memory utilization.
*/
#define SBP_MSG_LINUX_SYS_STATE 0x7F02
typedef struct SBP_ATTR_PACKED {
u16 mem_total; /**< total system memory */
u8 pcpu; /**< percent of total cpu currently utilized */
u8 pmem; /**< percent of total memory currently utilized */
u16 procs_starting; /**< number of processes that started during collection phase */
u16 procs_stopping; /**< number of processes that stopped during collection phase */
u16 pid_count; /**< the count of processes on the system */
} msg_linux_sys_state_t;


/** A list of processes with high socket counts
*
* Top 10 list of processes with high socket counts.
*/
#define SBP_MSG_LINUX_PROCESS_SOCKET_COUNTS 0x7F03
typedef struct SBP_ATTR_PACKED {
u8 index; /**< sequence of this status message, values from 0-9 */
u16 pid; /**< the PID of the process in question */
u16 socket_count; /**< the number of sockets the process is using */
u16 socket_types; /**< A bitfield indicating the socket types used:
0x1 (tcp), 0x2 (udp), 0x4 (unix stream), 0x8 (unix dgram), 0x10 (netlink),
and 0x8000 (unknown)
*/
u16 socket_states; /**< A bitfield indicating the socket states:
0x1 (established), 0x2 (syn-sent), 0x4 (syn-recv), 0x8 (fin-wait-1),
0x10 (fin-wait-2), 0x20 (time-wait), 0x40 (closed), 0x80 (close-wait),
0x100 (last-ack), 0x200 (listen), 0x400 (closing), 0x800 (unconnected),
and 0x8000 (unknown)
*/
char cmdline[0]; /**< the command line of the process in question */
} msg_linux_process_socket_counts_t;


/** A list of processes with deep socket queues
*
* Top 10 list of sockets with deep queues.
*/
#define SBP_MSG_LINUX_PROCESS_SOCKET_QUEUES 0x7F04
typedef struct SBP_ATTR_PACKED {
u8 index; /**< sequence of this status message, values from 0-9 */
u16 pid; /**< the PID of the process in question */
u16 recv_queued; /**< the total amount of receive data queued for this process */
u16 send_queued; /**< the total amount of send data queued for this process */
u16 socket_types; /**< A bitfield indicating the socket types used:
0x1 (tcp), 0x2 (udp), 0x4 (unix stream), 0x8 (unix dgram), 0x10 (netlink),
and 0x8000 (unknown)
*/
u16 socket_states; /**< A bitfield indicating the socket states:
0x1 (established), 0x2 (syn-sent), 0x4 (syn-recv), 0x8 (fin-wait-1),
0x10 (fin-wait-2), 0x20 (time-wait), 0x40 (closed), 0x80 (close-wait),
0x100 (last-ack), 0x200 (listen), 0x400 (closing), 0x800 (unconnected),
and 0x8000 (unknown)
*/
char address_of_largest[64]; /**< Address of the largest queue, remote or local depending on the directionality
of the connection.
*/
char cmdline[0]; /**< the command line of the process in question */
} msg_linux_process_socket_queues_t;


/** Summary of socket usage across the system
*
* Summaries the socket usage across the system.
*/
#define SBP_MSG_LINUX_SOCKET_USAGE 0x7F05
typedef struct SBP_ATTR_PACKED {
u32 avg_queue_depth; /**< average socket queue depths across all sockets on the system */
u32 max_queue_depth; /**< the max queue depth seen within the reporting period */
u16 socket_state_counts[16]; /**< A count for each socket type reported in the `socket_types_reported` field,
the first entry corresponds to the first enabled bit in `types_reported`.
*/
u16 socket_type_counts[16]; /**< A count for each socket type reported in the `socket_types_reported` field,
the first entry corresponds to the first enabled bit in `types_reported`.
*/
} msg_linux_socket_usage_t;


/** \} */

SBP_PACK_END

#endif /* LIBSBP_LINUX_MESSAGES_H */
1 change: 1 addition & 0 deletions c/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set(libsbp_HEADERS
"${PROJECT_SOURCE_DIR}/include/libsbp/flash.h"
"${PROJECT_SOURCE_DIR}/include/libsbp/gnss.h"
"${PROJECT_SOURCE_DIR}/include/libsbp/imu.h"
"${PROJECT_SOURCE_DIR}/include/libsbp/linux.h"
"${PROJECT_SOURCE_DIR}/include/libsbp/logging.h"
"${PROJECT_SOURCE_DIR}/include/libsbp/mag.h"
"${PROJECT_SOURCE_DIR}/include/libsbp/navigation.h"
Expand Down
Binary file modified docs/sbp.pdf
Binary file not shown.
5 changes: 4 additions & 1 deletion generator/sbpg/targets/javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ def construct_format(f, type_map=CONSTRUCT_CODE):
else:
field_type = "'%s'" % field_type
if size is not None:
return "array('%s', { length: %d, type: %s })" % (f.identifier, size.value, field_type)
d = { "'uint16'" : "'uint16le'", "'uint32'" : "'uint32le'", "'uint64'" : "'uint16le'",
"'int16'" : "'int16le'", "'int32'" : "'int32le'", "'int64'" : "'int16le'" }
field_type_arr = d.get(field_type, field_type)
return "array('%s', { length: %d, type: %s })" % (f.identifier, size.value, field_type_arr)
elif f.options.get('size_fn') is not None:
return "array('%s', { type: %s, length: '%s' })" % (f_.identifier, field_type, size_fn.value)
else:
Expand Down
3 changes: 2 additions & 1 deletion haskell/sbp.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ library
, SwiftNav.SBP.Flash
, SwiftNav.SBP.Gnss
, SwiftNav.SBP.Imu
, SwiftNav.SBP.Linux
, SwiftNav.SBP.Logging
, SwiftNav.SBP.Mag
, SwiftNav.SBP.Navigation
Expand Down Expand Up @@ -136,4 +137,4 @@ test-suite test
, tasty
, tasty-hunit
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall
default-language: Haskell2010
default-language: Haskell2010
5 changes: 3 additions & 2 deletions haskell/sbp.cabal.m4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: sbp
version: 2.4.1
version: 2.4.2
synopsis: SwiftNav's SBP Library
homepage: https://github.com/swift-nav/libsbp
license: LGPL-3
Expand Down Expand Up @@ -32,6 +32,7 @@ library
, SwiftNav.SBP.Flash
, SwiftNav.SBP.Gnss
, SwiftNav.SBP.Imu
, SwiftNav.SBP.Linux
, SwiftNav.SBP.Logging
, SwiftNav.SBP.Mag
, SwiftNav.SBP.Navigation
Expand Down Expand Up @@ -136,4 +137,4 @@ test-suite test
, tasty
, tasty-hunit
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall
default-language: Haskell2010
default-language: Haskell2010
12 changes: 12 additions & 0 deletions haskell/shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
with import <nixpkgs> {};

stdenv.mkDerivation rec {
name = "libsbp";
env = buildEnv { name = name; paths = buildInputs; };
buildInputs = [
jq
libiconv
stack
zlib.dev
];
}
1 change: 1 addition & 0 deletions haskell/src/SwiftNav/SBP.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import SwiftNav.SBP.FileIo as Exports
import SwiftNav.SBP.Flash as Exports
import SwiftNav.SBP.Gnss as Exports
import SwiftNav.SBP.Imu as Exports
import SwiftNav.SBP.Linux as Exports
import SwiftNav.SBP.Logging as Exports
import SwiftNav.SBP.Mag as Exports
import SwiftNav.SBP.Navigation as Exports
Expand Down
Loading