1, Return value check for snprintf function
2, Replace 'atoi' with 'strtol'
Tracked-On: #1254
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Kaige Fu <kaige.fu@intel.com>
This commit fixes several compiler warnings before enabling compiler
options to harden software by:
- remove unused variables;
- add parentheses around assignment as compiler suggests;
- print warning if format string is truncated.
Tracked-On: #1122
Signed-off-by: Yan, Like <like.yan@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
'err' may be used uninitialized and be dereferenced NULL.
This commit fix the reported issue via initializing 'err' to 0, and return 'err'
at the end of the func.
Tracked-On: #1157
Signed-off-by: Yan, Like <like.yan@intel.com>
Option "-r" has been removed by commit 3d6ff0e (tools: acrntrace: save trace
data file under current dir by default). But leaves something unused in optstring
and README.rst.
This patch remove thest related things.
BTW, this patch refine the usage output to print [-t max_time].
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Acked-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Like Yan <like.yan@intel.com>
Current implementation save trace data files on tmpfs by default, acrntrace
would use up all the physical mem, which can affect system functioning.
This commit changes default location for trace data file to current dir, and
removes the codes for space reservation, which is not necessary.
Signed-off-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
Reviewed-by: Li, Fei1 <fei1.li@intel.com>
The tools currently rely on the availability of binary "mkdir" to be available
in the $PATH on the Service OS. This creates an obscure dependency. The patch
changes the code to use standard C APIs to perform the same functionality which
makes the code more self-contained.
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
The tools currently rely on the availability of binary "ls" to be available in
the $PATH on the Service OS. This create an obscure dependency. The patch changes
the code to use standard C APIs to perform the same functionality which makes
the code more self-contained.
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Function get_cpu_freq is not used anymore. This patch remove it.
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
If option -t is configured, a timer will be set with configured timeout when
launching acrntrace. When timer fired, acrntrace will exit.
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Option -i is more suitable for interval. Meanwhile, we will use option -t for
timeout in later patch.
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
acrntrace writes trace data to /tmp with unlimited size and will cause tmpfs
100% occupied. Consequently, some problem will raise up on SOS, like failing to
exec cmd.
This patch introduce an option -r to let user configre minimal space left on the
disk which ensures that acrntrace will exit when free storage space is less than
the reserved space. By default, we reserve 512M on the disk. Users can configure
reserved space through '-r'.
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Benefits of outputing trace data as raw data:
- Smaller trace data size
- More convenient to add new trace entry. There is no need to change acrntrace
when we add new trace entry to HV. All we need do is to update the analysis
scripts to deal with this situation.
Trace data size(with 1 UOS):
~57M -- with patch
~137M -- without patch
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Fix NULL pointer dereference if 'localtime()' execution encountered an error,
in create_trace_file_dir().
Signed-off-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
The tools directory is moved out of ./devicemodle, to be in parallel with
hypervisor, devicemodel and doc.
Signed-off-by: Yan, Like <like.yan@intel.com>