|
|
От: |
Cyberax
|
|
| Дата: | 04.07.06 08:30 | ||
| Оценка: | -1 | ||
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Diagnostics;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Stopwatch timer = Stopwatch.StartNew();
string[] files = Directory.GetFiles(@"c:/windows/system32");
DateTime oldestTime = DateTime.Now;
foreach (string file in files)
{
DateTime dt = File.GetLastWriteTime(file);
try
{
FileStream fl = File.OpenRead(file);
fl.Dispose();
} catch (IOException ex) { }
oldestTime = dt > oldestTime ? dt : oldestTime;
}
Console.WriteLine(timer.Elapsed);
Console.WriteLine("В каталоге " + files.Length + " файлов.");
Console.WriteLine("Самый старый файл обновлялся " +
oldestTime);
int a = 0;
}
}
}Машина — двухпроцессорный AMD64 с 4Гб памяти (нет у меня FW2 на моемE:\Users\Cyberax\TestSpeed\TestSpeed\bin\x64\Debug>TestSpeed.exe
00:00:02.1704177
? ???????? 5680 ??????.
????? ?????? ???? ?????????? 7/4/2006 1:07:50 PM
import os
DIR = '/var/lib/vpopmail/[хрумс]/Maildir/cur'
maxsize = 0
for f in os.listdir(DIR):
path = os.path.join(DIR, f)
fl = open(path,"rb")
fl.close()
sz = os.path.getsize(path)
if sz>maxsize: maxsize=sz
print "The biggest readable file is %d bytes." % maxsizeroot@scblinux:~/test-sp# time python test.py
The biggest readable file is 33748150 bytes.
real 0m0.118s
user 0m0.064s
sys 0m0.052s
root@scblinux:~/test-sp# ls /var/lib/vpopmail/[хрумс]/Maildir/cur | wc
9062 9062 244345
root@scblinux:~/test-sp# cat /proc/cpuinfo | grep "model name"
model name : AMD Athlon(tm) 64 Processor 3000+
root@scblinux:~/test-sp# cat /etc/issue.net
Debian GNU/Linux testing/unstable
root@scblinux:~/test-sp# cat /etc/fstab | grep "/ "
/dev/md2 / reiserfs notail 0 1