Skip to content

Commit

Permalink
Add 'Number of compare threads' textbox to Options dialog. (Merge fro…
Browse files Browse the repository at this point in the history
…m WinMerge2011)
  • Loading branch information
sdottaka committed Dec 14, 2016
1 parent b2e4f41 commit a09d08a
Show file tree
Hide file tree
Showing 39 changed files with 196 additions and 12 deletions.
15 changes: 14 additions & 1 deletion Src/DirScan.cpp
Expand Up @@ -34,6 +34,8 @@
#include "paths.h"
#include "Plugins.h"
#include "MergeApp.h"
#include "OptionsDef.h"
#include "OptionsMgr.h"

using Poco::NotificationQueue;
using Poco::Notification;
Expand Down Expand Up @@ -454,9 +456,20 @@ int DirScan_CompareItems(DiffFuncStruct *myStruct, uintptr_t parentdiffpos)
ThreadPool threadPool;
std::vector<DiffWorkerPtr> workers;
const int compareMethod = myStruct->context->GetCompareMethod();
unsigned nworkers = (compareMethod == CMP_CONTENT || compareMethod == CMP_QUICK_CONTENT) ? Environment::processorCount() : 1;
int nworkers = 1;
NotificationQueue queue;

if (compareMethod == CMP_CONTENT || compareMethod == CMP_QUICK_CONTENT)
{
nworkers = GetOptionsMgr()->GetInt(OPT_CMP_COMPARE_THREADS);
if (nworkers <= 0)
{
nworkers += Environment::processorCount();
if (nworkers <= 0)
nworkers = 1;
}
}

myStruct->context->m_pCompareStats->SetCompareThreadCount(nworkers);
for (unsigned i = 0; i < nworkers; ++i)
{
Expand Down
4 changes: 3 additions & 1 deletion Src/Merge.rc
Expand Up @@ -1675,8 +1675,10 @@ BEGIN
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,72,202,10
CONTROL "Ignore &Reparse Points",IDC_IGNORE_REPARSEPOINTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,84,202,10
LTEXT "&Quick compare limit (MB):",IDC_STATIC,7,96,200,10
EDITTEXT IDC_COMPARE_QUICKC_LIMIT,7,108,50,14,ES_AUTOHSCROLL,WS_EX_RTLREADING
EDITTEXT IDC_COMPARE_QUICKC_LIMIT,7,108,30,14,ES_AUTOHSCROLL,
PUSHBUTTON "Defaults",IDC_COMPAREFOLDER_DEFAULTS,7,198,70,14
LTEXT "&Number of compare threads (a negative value implies addition of the number of available CPU cores):",IDC_STATIC,7,124,200,30
EDITTEXT IDC_COMPARE_THREAD_COUNT,7,156,30,14,ES_AUTOHSCROLL,
END

IDD_PROPPAGE_COMPARE_BINARY DIALOGEX 0, 0, 235, 205
Expand Down
1 change: 1 addition & 0 deletions Src/OptionsDef.h
Expand Up @@ -157,6 +157,7 @@ extern const String OPT_CMP_MOVED_BLOCKS OP("Settings/MovedBlocks");
extern const String OPT_CMP_MATCH_SIMILAR_LINES OP("Settings/MatchSimilarLines");
extern const String OPT_CMP_STOP_AFTER_FIRST OP("Settings/StopAfterFirst");
extern const String OPT_CMP_QUICK_LIMIT OP("Settings/QuickMethodLimit");
extern const String OPT_CMP_COMPARE_THREADS OP("Settings/CompareThreads");
extern const String OPT_CMP_WALK_UNIQUE_DIRS OP("Settings/ScanUnpairedDir");
extern const String OPT_CMP_IGNORE_REPARSE_POINTS OP("Settings/IgnoreReparsePoints");
extern const String OPT_CMP_INCLUDE_SUBDIRS OP("Settings/Recurse");
Expand Down
1 change: 1 addition & 0 deletions Src/OptionsInit.cpp
Expand Up @@ -122,6 +122,7 @@ void Init(COptionsMgr *pOptions)
pOptions->InitOption(OPT_CMP_MATCH_SIMILAR_LINES, false);
pOptions->InitOption(OPT_CMP_STOP_AFTER_FIRST, false);
pOptions->InitOption(OPT_CMP_QUICK_LIMIT, 4 * 1024 * 1024); // 4 Megs
pOptions->InitOption(OPT_CMP_COMPARE_THREADS, -1);
pOptions->InitOption(OPT_CMP_WALK_UNIQUE_DIRS, false);
pOptions->InitOption(OPT_CMP_IGNORE_REPARSE_POINTS, false);
pOptions->InitOption(OPT_CMP_IGNORE_CODEPAGE, true);
Expand Down
5 changes: 5 additions & 0 deletions Src/PropCompareFolder.cpp
Expand Up @@ -30,6 +30,7 @@ PropCompareFolder::PropCompareFolder(COptionsMgr *optionsMgr)
, m_bExpandSubdirs(FALSE)
, m_bIgnoreReparsePoints(FALSE)
, m_nQuickCompareLimit(4 * Mega)
, m_nCompareThreads(-1)
{
}

Expand All @@ -45,6 +46,7 @@ void PropCompareFolder::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_EXPAND_SUBDIRS, m_bExpandSubdirs);
DDX_Check(pDX, IDC_IGNORE_REPARSEPOINTS, m_bIgnoreReparsePoints);
DDX_Text(pDX, IDC_COMPARE_QUICKC_LIMIT, m_nQuickCompareLimit);
DDX_Text(pDX, IDC_COMPARE_THREAD_COUNT, m_nCompareThreads);
//}}AFX_DATA_MAP
UpdateControls();
}
Expand Down Expand Up @@ -73,6 +75,7 @@ void PropCompareFolder::ReadOptions()
m_bExpandSubdirs = GetOptionsMgr()->GetBool(OPT_DIRVIEW_EXPAND_SUBDIRS);
m_bIgnoreReparsePoints = GetOptionsMgr()->GetBool(OPT_CMP_IGNORE_REPARSE_POINTS);
m_nQuickCompareLimit = GetOptionsMgr()->GetInt(OPT_CMP_QUICK_LIMIT) / Mega ;
m_nCompareThreads = GetOptionsMgr()->GetInt(OPT_CMP_COMPARE_THREADS);
}

/**
Expand All @@ -93,6 +96,7 @@ void PropCompareFolder::WriteOptions()
if (m_nQuickCompareLimit > 2000)
m_nQuickCompareLimit = 2000;
GetOptionsMgr()->SaveOption(OPT_CMP_QUICK_LIMIT, m_nQuickCompareLimit * Mega);
GetOptionsMgr()->SaveOption(OPT_CMP_COMPARE_THREADS, m_nCompareThreads);
}

/**
Expand Down Expand Up @@ -133,6 +137,7 @@ void PropCompareFolder::OnDefaults()
m_bExpandSubdirs = GetOptionsMgr()->GetDefault<bool>(OPT_DIRVIEW_EXPAND_SUBDIRS);
m_bIgnoreReparsePoints = GetOptionsMgr()->GetDefault<bool>(OPT_CMP_IGNORE_REPARSE_POINTS);
m_nQuickCompareLimit = GetOptionsMgr()->GetDefault<unsigned>(OPT_CMP_QUICK_LIMIT) / Mega;
m_nCompareThreads = GetOptionsMgr()->GetDefault<unsigned>(OPT_CMP_COMPARE_THREADS);
UpdateData(FALSE);
}

Expand Down
1 change: 1 addition & 0 deletions Src/PropCompareFolder.h
Expand Up @@ -43,6 +43,7 @@ class PropCompareFolder : public OptionsPanel
bool m_bExpandSubdirs;
bool m_bIgnoreReparsePoints;
unsigned m_nQuickCompareLimit;
int m_nCompareThreads;
//}}AFX_DATA


Expand Down
19 changes: 10 additions & 9 deletions Src/resource.h
Expand Up @@ -482,14 +482,15 @@
#define IDC_COMPARE_WALKSUBDIRS 1339
#define IDC_COMPARE_QUICKC_LIMIT 1340
#define IDC_REPORT_INCLUDEFILECMPREPORT 1341
#define IDC_SWAP01_BUTTON 1342
#define IDC_SWAP12_BUTTON 1343
#define IDC_SWAP02_BUTTON 1344
#define IDC_COLORSCHEME_GITHUBBITBUCKET 1345
#define IDC_FINDDLG_DONTCLOSE 1346
#define IDC_PATH_COMPARING 1347
#define IDC_REGISTER_SHELLEXTENSION 1348
#define IDC_UNREGISTER_SHELLEXTENSION 1349
#define IDC_COMPARE_THREAD_COUNT 1342
#define IDC_SWAP01_BUTTON 1343
#define IDC_SWAP12_BUTTON 1344
#define IDC_SWAP02_BUTTON 1345
#define IDC_COLORSCHEME_GITHUBBITBUCKET 1346
#define IDC_FINDDLG_DONTCLOSE 1347
#define IDC_PATH_COMPARING 1348
#define IDC_REGISTER_SHELLEXTENSION 1349
#define IDC_UNREGISTER_SHELLEXTENSION 1350
#define IDC_EDIT_WHOLE_WORD 8603
#define IDC_EDIT_MATCH_CASE 8604
#define IDC_EDIT_FINDTEXT 8605
Expand Down Expand Up @@ -1226,7 +1227,7 @@
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 244
#define _APS_NEXT_RESOURCE_VALUE 245
#define _APS_NEXT_COMMAND_VALUE 33545
#define _APS_NEXT_CONTROL_VALUE 8809
#define _APS_NEXT_SYMED_VALUE 115
Expand Down
5 changes: 5 additions & 0 deletions Translations/WinMerge/Basque.po
Expand Up @@ -2703,6 +2703,11 @@ msgstr ""
msgid "&Quick compare limit (MB):"
msgstr "&Alderaketa azkar muga (MB):"

#: Merge.rc:2188DD49
#, c-format
msgid "&Number of compare threads (a negative value implies addition of the number of available CPU cores):"
msgstr ""

#: Merge.rc:17BC2F9E
#, c-format
msgid "Binary"
Expand Down
5 changes: 5 additions & 0 deletions Translations/WinMerge/Brazilian.po
Expand Up @@ -2702,6 +2702,11 @@ msgstr ""
msgid "&Quick compare limit (MB):"
msgstr ""

#: Merge.rc:2188DD49
#, c-format
msgid "&Number of compare threads (a negative value implies addition of the number of available CPU cores):"
msgstr ""

#: Merge.rc:17BC2F9E
#, c-format
msgid "Binary"
Expand Down
5 changes: 5 additions & 0 deletions Translations/WinMerge/Bulgarian.po
Expand Up @@ -2696,6 +2696,11 @@ msgstr ""
msgid "&Quick compare limit (MB):"
msgstr ""

#: Merge.rc:2188DD49
#, c-format
msgid "&Number of compare threads (a negative value implies addition of the number of available CPU cores):"
msgstr ""

#: Merge.rc:17BC2F9E
#, c-format
msgid "Binary"
Expand Down
5 changes: 5 additions & 0 deletions Translations/WinMerge/Catalan.po
Expand Up @@ -2695,6 +2695,11 @@ msgstr ""
msgid "&Quick compare limit (MB):"
msgstr ""

#: Merge.rc:2188DD49
#, c-format
msgid "&Number of compare threads (a negative value implies addition of the number of available CPU cores):"
msgstr ""

#: Merge.rc:17BC2F9E
#, c-format
msgid "Binary"
Expand Down
5 changes: 5 additions & 0 deletions Translations/WinMerge/ChineseSimplified.po
Expand Up @@ -2696,6 +2696,11 @@ msgstr ""
msgid "&Quick compare limit (MB):"
msgstr ""

#: Merge.rc:2188DD49
#, c-format
msgid "&Number of compare threads (a negative value implies addition of the number of available CPU cores):"
msgstr ""

#: Merge.rc:17BC2F9E
#, c-format
msgid "Binary"
Expand Down
5 changes: 5 additions & 0 deletions Translations/WinMerge/ChineseTraditional.po
Expand Up @@ -2710,6 +2710,11 @@ msgstr "
msgid "&Quick compare limit (MB):"
msgstr "快速比較之檔案大小上限 (MB)(&Q):"

#: Merge.rc:2188DD49
#, c-format
msgid "&Number of compare threads (a negative value implies addition of the number of available CPU cores):"
msgstr ""

#: Merge.rc:17BC2F9E
#, c-format
msgid "Binary"
Expand Down
5 changes: 5 additions & 0 deletions Translations/WinMerge/Croatian.po
Expand Up @@ -2700,6 +2700,11 @@ msgstr ""
msgid "&Quick compare limit (MB):"
msgstr ""

#: Merge.rc:2188DD49
#, c-format
msgid "&Number of compare threads (a negative value implies addition of the number of available CPU cores):"
msgstr ""

#: Merge.rc:17BC2F9E
#, c-format
msgid "Binary"
Expand Down
5 changes: 5 additions & 0 deletions Translations/WinMerge/Czech.po
Expand Up @@ -2698,6 +2698,11 @@ msgstr ""
msgid "&Quick compare limit (MB):"
msgstr "&Omezení pro rychlé porovnání (MB):"

#: Merge.rc:2188DD49
#, c-format
msgid "&Number of compare threads (a negative value implies addition of the number of available CPU cores):"
msgstr ""

#: Merge.rc:17BC2F9E
#, c-format
msgid "Binary"
Expand Down
5 changes: 5 additions & 0 deletions Translations/WinMerge/Danish.po
Expand Up @@ -2707,6 +2707,11 @@ msgstr ""
msgid "&Quick compare limit (MB):"
msgstr "&Grænse for hurtig sammenligning (MB):"

#: Merge.rc:2188DD49
#, c-format
msgid "&Number of compare threads (a negative value implies addition of the number of available CPU cores):"
msgstr ""

#: Merge.rc:17BC2F9E
#, c-format
msgid "Binary"
Expand Down
5 changes: 5 additions & 0 deletions Translations/WinMerge/Dutch.po
Expand Up @@ -2708,6 +2708,11 @@ msgstr ""
msgid "&Quick compare limit (MB):"
msgstr "Limiet snelvergelijking (MB):"

#: Merge.rc:2188DD49
#, c-format
msgid "&Number of compare threads (a negative value implies addition of the number of available CPU cores):"
msgstr ""

#: Merge.rc:17BC2F9E
#, c-format
msgid "Binary"
Expand Down
7 changes: 6 additions & 1 deletion Translations/WinMerge/English.pot
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WinMerge\n"
"Report-Msgid-Bugs-To: http://bugs.winmerge.org/\n"
"POT-Creation-Date: 2016-10-22 19:52+0000\n"
"POT-Creation-Date: 2016-12-15 01:14+0000\n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: English <winmerge-translate@lists.sourceforge.net>\n"
Expand Down Expand Up @@ -2692,6 +2692,11 @@ msgstr ""
msgid "&Quick compare limit (MB):"
msgstr ""

#: Merge.rc:2188DD49
#, c-format
msgid "&Number of compare threads (a negative value implies addition of the number of available CPU cores):"
msgstr ""

#: Merge.rc:17BC2F9E
#, c-format
msgid "Binary"
Expand Down
5 changes: 5 additions & 0 deletions Translations/WinMerge/French.po
Expand Up @@ -2704,6 +2704,11 @@ msgstr ""
msgid "&Quick compare limit (MB):"
msgstr "&Limite de comparaison rapide (MO):"

#: Merge.rc:2188DD49
#, c-format
msgid "&Number of compare threads (a negative value implies addition of the number of available CPU cores):"
msgstr ""

#: Merge.rc:17BC2F9E
#, c-format
msgid "Binary"
Expand Down
5 changes: 5 additions & 0 deletions Translations/WinMerge/Galician.po
Expand Up @@ -2701,6 +2701,11 @@ msgstr ""
msgid "&Quick compare limit (MB):"
msgstr ""

#: Merge.rc:2188DD49
#, c-format
msgid "&Number of compare threads (a negative value implies addition of the number of available CPU cores):"
msgstr ""

#: Merge.rc:17BC2F9E
#, c-format
msgid "Binary"
Expand Down
5 changes: 5 additions & 0 deletions Translations/WinMerge/German.po
Expand Up @@ -2705,6 +2705,11 @@ msgstr ""
msgid "&Quick compare limit (MB):"
msgstr "&Limit für Schneller Inhalt (MB):"

#: Merge.rc:2188DD49
#, c-format
msgid "&Number of compare threads (a negative value implies addition of the number of available CPU cores):"
msgstr ""

#: Merge.rc:17BC2F9E
#, c-format
msgid "Binary"
Expand Down
5 changes: 5 additions & 0 deletions Translations/WinMerge/Greek.po
Expand Up @@ -2695,6 +2695,11 @@ msgstr ""
msgid "&Quick compare limit (MB):"
msgstr ""

#: Merge.rc:2188DD49
#, c-format
msgid "&Number of compare threads (a negative value implies addition of the number of available CPU cores):"
msgstr ""

#: Merge.rc:17BC2F9E
#, c-format
msgid "Binary"
Expand Down
5 changes: 5 additions & 0 deletions Translations/WinMerge/Hungarian.po
Expand Up @@ -2696,6 +2696,11 @@ msgstr ""
msgid "&Quick compare limit (MB):"
msgstr ""

#: Merge.rc:2188DD49
#, c-format
msgid "&Number of compare threads (a negative value implies addition of the number of available CPU cores):"
msgstr ""

#: Merge.rc:17BC2F9E
#, c-format
msgid "Binary"
Expand Down
5 changes: 5 additions & 0 deletions Translations/WinMerge/Italian.po
Expand Up @@ -2696,6 +2696,11 @@ msgstr ""
msgid "&Quick compare limit (MB):"
msgstr ""

#: Merge.rc:2188DD49
#, c-format
msgid "&Number of compare threads (a negative value implies addition of the number of available CPU cores):"
msgstr ""

#: Merge.rc:17BC2F9E
#, c-format
msgid "Binary"
Expand Down
5 changes: 5 additions & 0 deletions Translations/WinMerge/Japanese.po
Expand Up @@ -2715,6 +2715,11 @@ msgstr "
msgid "&Quick compare limit (MB):"
msgstr "クイックコンテンツ制限(MB)(&Q):"

#: Merge.rc:2188DD49
#, c-format
msgid "&Number of compare threads (a negative value implies addition of the number of available CPU cores):"
msgstr "比較スレッドの数 (負の値を指定するとスレッド数は、使用可能なCPUコア数が加算された値になります)(&N):"

#: Merge.rc:17BC2F9E
#, c-format
msgid "Binary"
Expand Down
5 changes: 5 additions & 0 deletions Translations/WinMerge/Korean.po
Expand Up @@ -2697,6 +2697,11 @@ msgstr ""
msgid "&Quick compare limit (MB):"
msgstr ""

#: Merge.rc:2188DD49
#, c-format
msgid "&Number of compare threads (a negative value implies addition of the number of available CPU cores):"
msgstr ""

#: Merge.rc:17BC2F9E
#, c-format
msgid "Binary"
Expand Down
5 changes: 5 additions & 0 deletions Translations/WinMerge/Norwegian.po
Expand Up @@ -2700,6 +2700,11 @@ msgstr ""
msgid "&Quick compare limit (MB):"
msgstr ""

#: Merge.rc:2188DD49
#, c-format
msgid "&Number of compare threads (a negative value implies addition of the number of available CPU cores):"
msgstr ""

#: Merge.rc:17BC2F9E
#, c-format
msgid "Binary"
Expand Down

0 comments on commit a09d08a

Please sign in to comment.