<commit_before>//------------------------------ kaKernelView.cpp ------------------------------

// Infra:
#include <AMDTBaseTools/Include/gtAssert.h>
#include <AMDTBaseTools/Include/gtString.h>
#include <AMDTBaseTools/Include/gtStringTokenizer.h>
#include <AMDTApplicationComponents/Include/acFunctions.h>

// Framework:
#include <AMDTApplicationFramework/Include/afApplicationCommands.h>
#include <AMDTApplicationFramework/Include/afAppStringConstants.h>
#include <AMDTApplicationFramework/Include/afProgressBarWrapper.h>
#include <AMDTApplicationFramework/Include/afTreeItemType.h>

// Local:
#include <AMDTKernelAnalyzer/src/kaAnalysisView.h>
#include <AMDTKernelAnalyzer/src/kaKernelView.h>
#include <AMDTKernelAnalyzer/src/kaMultiSourceView.h>
#include <AMDTKernelAnalyzer/src/kaOverviewView.h>
#include <AMDTKernelAnalyzer/src/kaProjectDataManager.h>
#include <AMDTKernelAnalyzer/src/kaStatisticsView.h>
#include <AMDTKernelAnalyzer/src/kaDataTypes.h>
#include <AMDTKernelAnalyzer/Include/kaStringConstants.h>
#include <AMDTKernelAnalyzer/src/kaUtils.h>


// ---------------------------------------------------------------------------
// Name:        kaKernelView
// Description: constructor
// Author:      <NAME>
// Date:        18/8/2013
// ---------------------------------------------------------------------------
kaKernelView::kaKernelView(QWidget* pParent): QWidget(pParent), afBaseView(&afProgressBarWrapper::instance()), m_pOverView(NULL)
{
    // Create the tab view in a layout and add it.
    m_pMainLayout = new QVBoxLayout(this);


    m_pTabWidget = new acTabWidget;

    m_pTabWidget->setTabsClosable(true);

    m_pMainLayout->addWidget(m_pTabWidget);
    m_pMainLayout->setContentsMargins(0, 0 , 0, 0);

    connect(m_pTabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(tabCloseRequestedHandler(int)));

    setLayout(m_pMainLayout);
}


// ---------------------------------------------------------------------------
// Name:        kaKernelView::~kaKernelView
// Description: destructor
// Author:      <NAME>
// Date:        18/8/2013
// ---------------------------------------------------------------------------
kaKernelView::~kaKernelView()
{

}


// ---------------------------------------------------------------------------
// Name:        kaKernelView::displayFile
// Description: Display a specific file. Opens it if it is not opened yet, or set the tab as active
//              if it is opened
// Author:      <NAME>
// Date:        18/8/2013
// ---------------------------------------------------------------------------
void kaKernelView::displayFile(const osFilePath& detailedFilePath, const osFilePath& kernelFilePath, int nodeType, QString nodeStr)
{
    bool tabFound = false;

    // check if the filePath is already displayed:
    if (m_filePathToViewMap.find(detailedFilePath.asString()) != m_filePathToViewMap.end())
    {
        // Find the tab with the same name as the file name and activate it:
        int indexOfView = m_filePathToViewMap[detailedFilePath.asString()];
        m_pTabWidget->setCurrentIndex(indexOfView);

        tabFound = true;
    }

    if (!tabFound || AF_TREE_ITEM_KA_DEVICE == nodeType)
    {
        QWidget* pCreatedView = NULL;

        // Create the appropriate view:
        switch (nodeType)
        {
            case AF_TREE_ITEM_KA_ANALYSIS:
            {
                pCreatedView = new kaAnalysisView(this, detailedFilePath);

            }
            break;

            case AF_TREE_ITEM_KA_STATISTICS:
            {
                //get program name from path
                boost::filesystem::path path(detailedFilePath.asString().asCharArray());
                gtString programName = kaUtils::ToGtString(path.parent_path().parent_path().filename());

                kaPlatform platform = KA_PROJECT_DATA_MGR_INSTANCE.GetBuildPlatform(programName);
                kaSourceFile* pFileData = KA_PROJECT_DATA_MGR_INSTANCE.dataFileByPath(kernelFilePath);
                gtString buildProfile;
                GT_IF_WITH_ASSERT(pFileData != nullptr)
                {
                    buildProfile = pFileData->BuildProfile();
                }
                pCreatedView = new kaStatisticsView(this, kernelFilePath, detailedFilePath, platform, buildProfile);
            }
            break;

            case AF_TREE_ITEM_KA_DEVICE:
            {
                bool isGCN = true;

                if (!nodeStr.isEmpty())
                {
                    QStringList nonGCNVersions = QString(KA_STR_NonGCNVersions).split(" ");

                    for (auto it : nonGCNVersions)
                    {
                        if (nodeStr.contains(it, Qt::CaseInsensitive))
                        {
                            isGCN = false;
                            break;
                        }
                    }
                }<commit_msg>Fixing CODEXL-3013For DX file Statistics, "LDS Size" shown in Resource and performance reference tables<commit_after>//------------------------------ kaKernelView.cpp ------------------------------

// Infra:
#include <AMDTBaseTools/Include/gtAssert.h>
#include <AMDTBaseTools/Include/gtString.h>
#include <AMDTBaseTools/Include/gtStringTokenizer.h>
#include <AMDTApplicationComponents/Include/acFunctions.h>

// Framework:
#include <AMDTApplicationFramework/Include/afApplicationCommands.h>
#include <AMDTApplicationFramework/Include/afAppStringConstants.h>
#include <AMDTApplicationFramework/Include/afProgressBarWrapper.h>
#include <AMDTApplicationFramework/Include/afTreeItemType.h>

// Local:
#include <AMDTKernelAnalyzer/src/kaAnalysisView.h>
#include <AMDTKernelAnalyzer/src/kaKernelView.h>
#include <AMDTKernelAnalyzer/src/kaMultiSourceView.h>
#include <AMDTKernelAnalyzer/src/kaOverviewView.h>
#include <AMDTKernelAnalyzer/src/kaProjectDataManager.h>
#include <AMDTKernelAnalyzer/src/kaStatisticsView.h>
#include <AMDTKernelAnalyzer/src/kaDataTypes.h>
#include <AMDTKernelAnalyzer/Include/kaStringConstants.h>
#include <AMDTKernelAnalyzer/src/kaUtils.h>


// ---------------------------------------------------------------------------
// Name:        kaKernelView
// Description: constructor
// Author:      <NAME>
// Date:        18/8/2013
// ---------------------------------------------------------------------------
kaKernelView::kaKernelView(QWidget* pParent): QWidget(pParent), afBaseView(&afProgressBarWrapper::instance()), m_pOverView(NULL)
{
    // Create the tab view in a layout and add it.
    m_pMainLayout = new QVBoxLayout(this);


    m_pTabWidget = new acTabWidget;

    m_pTabWidget->setTabsClosable(true);

    m_pMainLayout->addWidget(m_pTabWidget);
    m_pMainLayout->setContentsMargins(0, 0 , 0, 0);

    connect(m_pTabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(tabCloseRequestedHandler(int)));

    setLayout(m_pMainLayout);
}


// ---------------------------------------------------------------------------
// Name:        kaKernelView::~kaKernelView
// Description: destructor
// Author:      <NAME>
// Date:        18/8/2013
// ---------------------------------------------------------------------------
kaKernelView::~kaKernelView()
{

}


// ---------------------------------------------------------------------------
// Name:        kaKernelView::displayFile
// Description: Display a specific file. Opens it if it is not opened yet, or set the tab as active
//              if it is opened
// Author:      <NAME>
// Date:        18/8/2013
// ---------------------------------------------------------------------------
void kaKernelView::displayFile(const osFilePath& detailedFilePath, const osFilePath& kernelFilePath, int nodeType, QString nodeStr)
{
    bool tabFound = false;

    // check if the filePath is already displayed:
    if (m_filePathToViewMap.find(detailedFilePath.asString()) != m_filePathToViewMap.end())
    {
        // Find the tab with the same name as the file name and activate it:
        int indexOfView = m_filePathToViewMap[detailedFilePath.asString()];
        m_pTabWidget->setCurrentIndex(indexOfView);

        tabFound = true;
    }

    if (!tabFound || AF_TREE_ITEM_KA_DEVICE == nodeType)
    {
        QWidget* pCreatedView = NULL;

        // Create the appropriate view:
        switch (nodeType)
        {
            case AF_TREE_ITEM_KA_ANALYSIS:
            {
                pCreatedView = new kaAnalysisView(this, detailedFilePath);

            }
            break;

            case AF_TREE_ITEM_KA_STATISTICS:
            {
                //get program name from path
                boost::filesystem::path path(detailedFilePath.asString().asCharArray());
                gtString programName = kaUtils::ToGtString(path.parent_path().parent_path().filename());

                kaPlatform platform = KA_PROJECT_DATA_MGR_INSTANCE.GetBuildPlatform(programName);
                gtString buildProfile;
                kaProgram* pProgram = KA_PROJECT_DATA_MGR_INSTANCE.GetProgram(programName);
                kaDxFolder* pDXFolder = dynamic_cast<kaDxFolder*>(pProgram);
                if (pDXFolder != nullptr)
                {
                    int fileID = KA_PROJECT_DATA_MGR_INSTANCE.GetFileID(kernelFilePath);
                    pDXFolder->GetFileProfile(fileID, buildProfile);
                }
                pCreatedView = new kaStatisticsView(this, kernelFilePath, detailedFilePath, platform, buildProfile);
            }
            break;

            case AF_TREE_ITEM_KA_DEVICE:
            {
                bool isGCN = true;

                if (!nodeStr.isEmpty())
                {
                    QStringList nonGCNVersions = QString(KA_STR_NonGCNVersions).split(" ");

                    for (auto it : nonGCNVersions)
                    {
                        if (nodeStr.contains(it, Qt::CaseInsensitive))
                        {
                            isGCN = false;
                            break;
                        }
                    }
                }
{'fraction_non_alphanumeric': 0.19139763384800482, 'fraction_numerical': 0.0054140765991578105, 'mean_word_length': 1.783203125, 'pattern_counts': {'":': 0, '<': 44, '<?xml version=': 0, '>': 54, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2771093', 'n_tokens_mistral': 2720, 'n_tokens_neox': 2592, 'n_words': 486}