mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
ocloc getProductFamily, createDumpDir fix
getProductFamily no longer throws segfault error. Dumping directory is created automatically. Change-Id: Ia1f33dec1bf873312e5f7b842aaf189e98103590
This commit is contained in:
@ -17,6 +17,14 @@
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#define MakeDirectory _mkdir
|
||||
#else
|
||||
#include <sys/stat.h>
|
||||
#define MakeDirectory(dir) mkdir(dir, 0777)
|
||||
#endif
|
||||
|
||||
void BinaryDecoder::setMessagePrinter(const MessagePrinter &messagePrinter) {
|
||||
this->messagePrinter = messagePrinter;
|
||||
}
|
||||
@ -496,6 +504,8 @@ int BinaryDecoder::validateInput(uint32_t argc, const char **argv) {
|
||||
if (false == iga->isKnownPlatform()) {
|
||||
messagePrinter.printf("Warning : missing or invalid -device parameter - results may be inacurate\n");
|
||||
}
|
||||
|
||||
MakeDirectory(pathToDump.c_str());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -46,7 +46,8 @@ void readFileToVectorOfStrings(std::vector<std::string> &lines, const std::strin
|
||||
if (file.good()) {
|
||||
if (replaceTabs) {
|
||||
for (std::string line; std::getline(file, line);) {
|
||||
std::replace_if(line.begin(), line.end(), [](auto c) { return c == '\t'; }, ' ');
|
||||
std::replace_if(
|
||||
line.begin(), line.end(), [](auto c) { return c == '\t'; }, ' ');
|
||||
lines.push_back(std::move(line));
|
||||
}
|
||||
} else {
|
||||
@ -75,7 +76,8 @@ size_t findPos(const std::vector<std::string> &lines, const std::string &whatToF
|
||||
|
||||
PRODUCT_FAMILY getProductFamilyFromDeviceName(const std::string &deviceName) {
|
||||
for (unsigned int productId = 0; productId < IGFX_MAX_PRODUCT; ++productId) {
|
||||
if (deviceName == NEO::hardwarePrefix[productId]) {
|
||||
if (NEO::hardwarePrefix[productId] != nullptr &&
|
||||
deviceName == NEO::hardwarePrefix[productId]) {
|
||||
return static_cast<PRODUCT_FAMILY>(productId);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user