mirror of
https://gitee.com/openharmony/developtools_hiperf
synced 2024-11-30 03:01:08 +00:00
Replace /proc/version with uname -r to read hm version
Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
This commit is contained in:
parent
5ec63a7d49
commit
31b297b721
@ -13,6 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <sys/utsname.h>
|
||||
#include "subcommand_list.h"
|
||||
|
||||
using namespace std;
|
||||
@ -68,8 +69,11 @@ void SubCommandList::RegisterSubCommandList()
|
||||
|
||||
void SubCommandList::SetHM()
|
||||
{
|
||||
std::string version = ReadFileToString("/proc/version");
|
||||
isHM_ = version.find(HMKERNEL) != std::string::npos;
|
||||
utsname unameBuf;
|
||||
if ((uname(&unameBuf)) == 0) {
|
||||
std::string osrelease = unameBuf.release;
|
||||
isHM_ = osrelease.find(HMKERNEL) != std::string::npos;
|
||||
}
|
||||
perfEvents_.SetHM(isHM_);
|
||||
HLOGD("Set isHM_: %d", isHM_);
|
||||
}
|
||||
|
@ -1764,8 +1764,11 @@ bool SubCommandRecord::RegisterSubCommandRecord(void)
|
||||
|
||||
void SubCommandRecord::SetHM()
|
||||
{
|
||||
std::string version = ReadFileToString(PROC_VERSION);
|
||||
isHM_ = version.find(HMKERNEL) != std::string::npos;
|
||||
utsname unameBuf;
|
||||
if ((uname(&unameBuf)) == 0) {
|
||||
std::string osrelease = unameBuf.release;
|
||||
isHM_ = osrelease.find(HMKERNEL) != std::string::npos;
|
||||
}
|
||||
virtualRuntime_.SetHM(isHM_);
|
||||
perfEvents_.SetHM(isHM_);
|
||||
HLOGD("Set isHM_: %d", isHM_);
|
||||
|
Loading…
Reference in New Issue
Block a user