提交 344ec1b3 编写于 作者: C Calvin Miao 提交者: Jiangtao Hu

Perception: fixed lib/util build issues

上级 c4e0c294
load("//tools:cpplint.bzl", "cpplint")
package(default_visibility = ["//visibility:public"])
cc_library(
name = "perception_perf",
hdrs = ["perf.h"],
)
cc_library(
name = "perception_timer",
srcs = ["timer.cc"],
hdrs = ["timer.h"],
deps = [
"//framework:cybertron",
":perception_perf",
],
)
cc_test(
name = "perception_timer_test",
size = "small",
srcs = ["timer_test.cc"],
deps = [
":perception_timer",
"@gtest//:main",
],
)
cc_library(
name = "perception_time_util",
hdrs = ["time_util.h"],
)
cc_test(
name = "perception_time_util_test",
size = "small",
srcs = ["time_util_test.cc"],
deps = [
":perception_time_util",
"@gtest//:main",
],
)
cc_library(
name = "perception_string_util",
srcs = ["string_util.cc"],
hdrs = ["string_util.h"],
deps = [
"//framework:cybertron",
],
)
cc_test(
name = "perception_string_util_test",
size = "small",
srcs = ["string_util_test.cc"],
deps = [
":perception_string_util",
"@gtest//:main",
],
)
cpplint()
......@@ -17,7 +17,7 @@
#include <algorithm>
#include "modules/perception/base/log.h"
#include "cybertron/common/log.h"
namespace apollo {
namespace perception {
......@@ -63,7 +63,7 @@ void StringUtil::Trim(TrimType type, string *result_str) {
Trim(TRIM_RIGHT, result_str);
break;
default:
LOG_ERROR << "Invalid trim type, type: " << type;
AERROR << "Invalid trim type, type: " << type;
break;
}
}
......@@ -121,7 +121,7 @@ bool StringUtil::StrToInt(const string &str, int *ret_val) {
*ret_val = std::stoi(str);
return true;
} catch (...) {
LOG_ERROR << "std::stoi() failed.str:" << str;
AERROR << "std::stoi() failed.str:" << str;
return false;
}
}
......
......@@ -13,8 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#ifndef PERCEPTION_LIB_UTILS_STRING_UTIL_H_
#define PERCEPTION_LIB_UTILS_STRING_UTIL_H_
#ifndef MODULES_PERCEPTION_LIB_UTILS_STRING_UTIL_H_
#define MODULES_PERCEPTION_LIB_UTILS_STRING_UTIL_H_
#include <string>
#include <vector>
......@@ -96,4 +97,4 @@ std::string StringUtil::Digit2String(T number) {
} // namespace perception
} // namespace apollo
#endif // PERCEPTION_LIB_UTILS_STRING_UTIL_H_
#endif // MODULES_PERCEPTION_LIB_UTILS_STRING_UTIL_H_
......@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#ifndef PERCEPTION_LIB_UTILS_TIME_UTIL_H_
#define PERCEPTION_LIB_UTILS_TIME_UTIL_H_
#ifndef MODULES_PERCEPTION_LIB_UTILS_TIME_UTIL_H_
#define MODULES_PERCEPTION_LIB_UTILS_TIME_UTIL_H_
#include <sys/time.h>
......@@ -63,4 +63,4 @@ class TimeUtil {
} // namespace perception
} // namespace apollo
#endif // PERCEPTION_LIB_UTILS_TIME_UTIL_H_
#endif // MODULES_PERCEPTION_LIB_UTILS_TIME_UTIL_H_
......@@ -17,7 +17,6 @@
#include <cmath>
#include "modules/perception/base/log.h"
#include "modules/perception/lib/utils/time_util.h"
namespace apollo {
......@@ -49,9 +48,6 @@ TEST(TimeUtilTest, TestGetCurrentTime) {
uint64_t current_time = ::time(NULL);
if (std::fabs(unix_time - current_time) < 1) {
return;
} else {
LOG_INFO << "unix_time=" << unix_time
<< " , current_time=" << current_time;
}
usleep(50000); // 50ms
}
......
......@@ -13,9 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include <sys/time.h>
#include "modules/perception/base/log.h"
#include "cybertron/common/log.h"
#include "modules/perception/lib/utils/timer.h"
namespace apollo {
......@@ -37,7 +38,7 @@ uint64_t Timer::End(const string &msg) {
end_time_ = tv.tv_sec * 1000 + tv.tv_usec / 1000;
uint64_t elapsed_time = end_time_ - start_time_;
LOG_INFO << "TIMER " << msg << " elapsed_time: " << elapsed_time << " ms";
ADEBUG << "TIMER " << msg << " elapsed_time: " << elapsed_time << " ms";
// start new timer.
start_time_ = end_time_;
......
......@@ -13,8 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#ifndef PERCEPTION_LIB_UTILS_TIMER_H_
#define PERCEPTION_LIB_UTILS_TIMER_H_
#ifndef MODULES_PERCEPTION_LIB_UTILS_TIMER_H_
#define MODULES_PERCEPTION_LIB_UTILS_TIMER_H_
#include <stdint.h>
#include <string>
......@@ -63,4 +64,4 @@ class TimerWrapper {
} // namespace perception
} // namespace apollo
#endif // PERCEPTION_LIB_UTILS_TIMER_H_
#endif // MODULES_PERCEPTION_LIB_UTILS_TIMER_H_
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册