Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
58d287ea
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
58d287ea
编写于
7月 26, 2022
作者:
wafwerar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
os: fix get cpuinfo error
上级
97e3946a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
9 deletion
+21
-9
source/os/src/osSysinfo.c
source/os/src/osSysinfo.c
+17
-1
tests/system-test/2-query/cast.py
tests/system-test/2-query/cast.py
+4
-8
未找到文件。
source/os/src/osSysinfo.c
浏览文件 @
58d287ea
...
...
@@ -374,9 +374,10 @@ int32_t taosGetCpuInfo(char *cpuModel, int32_t maxLen, float *numOfCores) {
size_t
size
=
0
;
int32_t
done
=
0
;
int32_t
code
=
-
1
;
float
coreCount
=
0
;
TdFilePtr
pFile
=
taosOpenFile
(
"/proc/cpuinfo"
,
TD_FILE_READ
|
TD_FILE_STREAM
);
if
(
pFile
==
NULL
)
return
fals
e
;
if
(
pFile
==
NULL
)
return
cod
e
;
while
(
done
!=
3
&&
(
size
=
taosGetLineFile
(
pFile
,
&
line
))
!=
-
1
)
{
line
[
size
-
1
]
=
'\0'
;
...
...
@@ -390,11 +391,26 @@ int32_t taosGetCpuInfo(char *cpuModel, int32_t maxLen, float *numOfCores) {
*
numOfCores
=
atof
(
v
);
done
|=
2
;
}
if
(
strncmp
(
line
,
"processor"
,
9
)
==
0
)
coreCount
+=
1
;
}
if
(
line
!=
NULL
)
taosMemoryFree
(
line
);
taosCloseFile
(
&
pFile
);
if
(
code
!=
0
)
{
TdFilePtr
pFile1
=
taosOpenFile
(
"/proc/device-tree/model"
,
TD_FILE_READ
|
TD_FILE_STREAM
);
if
(
pFile1
==
NULL
)
return
code
;
taosGetsFile
(
pFile1
,
maxLen
,
cpuModel
);
taosCloseFile
(
&
pFile1
);
code
=
0
;
done
|=
1
;
}
if
((
done
&
2
)
==
0
)
{
*
numOfCores
=
coreCount
;
done
|=
2
;
}
return
code
;
#endif
}
...
...
tests/system-test/2-query/cast.py
浏览文件 @
58d287ea
...
...
@@ -566,8 +566,7 @@ class TDTestCase:
if
data_ct4_c10
[
i
]
is
None
:
tdSql
.
checkData
(
i
,
0
,
None
)
else
:
# time2str = str(int((data_ct4_c10[i]-datetime.datetime.fromtimestamp(0)).total_seconds()*1000))
time2str
=
str
(
int
((
datetime
.
datetime
.
timestamp
(
data_ct4_c10
[
i
])
-
datetime
.
datetime
.
timestamp
(
datetime
.
datetime
.
fromtimestamp
(
0
)))
*
1000
))
time2str
=
str
(
int
((
data_ct4_c10
[
i
]
-
datetime
.
datetime
.
fromtimestamp
(
0
)).
total_seconds
()
*
1000
))
tdSql
.
checkData
(
i
,
0
,
time2str
)
tdSql
.
query
(
f
"select cast(c10 as nchar(32)) as b from
{
self
.
dbname
}
.t1"
)
for
i
in
range
(
len
(
data_t1_c10
)):
...
...
@@ -576,8 +575,7 @@ class TDTestCase:
elif
i
==
10
:
continue
else
:
# time2str = str(int((data_t1_c10[i]-datetime.datetime.fromtimestamp(0)).total_seconds()*1000))
time2str
=
str
(
int
((
datetime
.
datetime
.
timestamp
(
data_t1_c10
[
i
])
-
datetime
.
datetime
.
timestamp
(
datetime
.
datetime
.
fromtimestamp
(
0
)))
*
1000
))
time2str
=
str
(
int
((
data_t1_c10
[
i
]
-
datetime
.
datetime
.
fromtimestamp
(
0
)).
total_seconds
()
*
1000
))
tdSql
.
checkData
(
i
,
0
,
time2str
)
tdLog
.
printNoPrefix
(
"==========step38: cast timestamp to binary, expect no changes "
)
...
...
@@ -586,8 +584,7 @@ class TDTestCase:
if
data_ct4_c10
[
i
]
is
None
:
tdSql
.
checkData
(
i
,
0
,
None
)
else
:
# time2str = str(int((data_ct4_c10[i]-datetime.datetime.fromtimestamp(0)).total_seconds()*1000))
time2str
=
str
(
int
((
datetime
.
datetime
.
timestamp
(
data_ct4_c10
[
i
])
-
datetime
.
datetime
.
timestamp
(
datetime
.
datetime
.
fromtimestamp
(
0
)))
*
1000
))
time2str
=
str
(
int
((
data_ct4_c10
[
i
]
-
datetime
.
datetime
.
fromtimestamp
(
0
)).
total_seconds
()
*
1000
))
tdSql
.
checkData
(
i
,
0
,
time2str
)
tdSql
.
query
(
f
"select cast(c10 as binary(32)) as b from
{
self
.
dbname
}
.t1"
)
for
i
in
range
(
len
(
data_t1_c10
)):
...
...
@@ -596,8 +593,7 @@ class TDTestCase:
elif
i
==
10
:
continue
else
:
# time2str = str(int((data_t1_c10[i]-datetime.datetime.fromtimestamp(0)).total_seconds()*1000))
time2str
=
str
(
int
((
datetime
.
datetime
.
timestamp
(
data_t1_c10
[
i
])
-
datetime
.
datetime
.
timestamp
(
datetime
.
datetime
.
fromtimestamp
(
0
)))
*
1000
))
time2str
=
str
(
int
((
data_t1_c10
[
i
]
-
datetime
.
datetime
.
fromtimestamp
(
0
)).
total_seconds
()
*
1000
))
tdSql
.
checkData
(
i
,
0
,
time2str
)
tdLog
.
printNoPrefix
(
"==========step39: cast constant operation to bigint, expect change to int "
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录