Пример #1
0
        private void RunMemtest(int numDirs)
        {
            var sw  = Stopwatch.StartNew();
            var dir = _490Images;

            for (var i = 0; i < numDirs; i++)
            {
                var fileSet = new ListViewFileSet_BlockingLoadAllImages(dir, null, null, _filePatterns);
                _memoryTest.Add(fileSet);
                var listView = new ListView();
                InitializeListView(listView);
                _listViews.Add(listView);
                fileSet.BeginLoadingImages();
            }

            sw.Stop();

            Log(string.Format("loaded {0} {1} times in {2} msec", dir, numDirs, sw.ElapsedMilliseconds));

            var currentPrivateBytes = GetMemoryUsed();

            Log(string.Format("final memory usage:\t {0:N0}", currentPrivateBytes));
            var delta = currentPrivateBytes - _initialPrivateBytes;

            Log(string.Format("delta memory usage:\t {0:N0}", delta));
            var listCount = _memoryTest.Count;
            var perList   = currentPrivateBytes / listCount;

            Log(string.Format("memory usage per list: ({0} lists)\t {1:N0}", listCount, perList));

            var entryCount = _memoryTest.First().Count;
            var perEntry   = perList / entryCount;

            Log(string.Format("memory usage per entry: ({0} entries)\t {1:N0}", entryCount * listCount, perEntry));
        }
        public void Make()
        {
            var fileSet = new ListViewFileSet_BlockingLoadAllImages(TargetDirectory, _factory, InitializeListView, "*.jpg");

            Assert.IsTrue(InitializeListView_WasCalled);
            Assert.AreEqual(0, fileSet.ListView.Items.Count);
        }
        public void LoadFiles()
        {
            var fileSet = new ListViewFileSet_BlockingLoadAllImages(TargetDirectory, _factory, InitializeListView, "*.jpg");

            fileSet.BeginLoadingImages();

            Assert.IsTrue(fileSet.ListView.Items.ContainsKey(_file1));
            Assert.IsFalse(string.IsNullOrEmpty(fileSet.StatusMessage));
        }