一、各个模块的预计消耗及实际消耗
| PSP2.1 | Personal Software Process Stages |
预估耗时(min) | 实际耗时(min) |
| Planning | 计划 | ||
| ·Estimate | ·估计这个任务所需的时间 | 10 | 20 |
| Development | 开发 | ||
| ·Analysis | ·需求分析 | 30 | 30 |
| ·Design Spec | ·生成设计文档 | 60 | 60 |
| ·Design Review | ·设计复审 | 30 | 30 |
| ·Coding Standard | ·代码规范 | 30 | 30 |
| ·Design | ·具体设计 | 60 | 60 |
|
·Coding |
·具体编码 | 300 | 300 |
| ·Coding Review | ·代码复审 | 30 | 30 |
| ·Test | ·测试 | 30 | 30 |
| Reporting | 报告 | ||
| ·Test Report | ·测试报告 | 40 |
40 |
| ·Size Measurement | ·计算工作量 | 20 | 20 |
| ·Postmotem&Process Improvement Plan | ·事后总结,并做出过程改进计划 | 30 | 30 |
| 总计 | 670 |
680 |
二、性能分析
这个项目的主要目标就是同过程序实现对文件内容的分析,以得到所需的信息,最直接的方式就是通过对文件内字符的遍历来实现,所以这个程序性能的关键之一也就是选取合适的文件读取方式,还有一个关键点就是需要实现递归的检索当前目录以及子目录下的所有文件,对于文件检索的算法,我们选择通过_findfirst来实现。
以下是主要性能分析图


其中消耗最大的函数为:
void currsion(string path, char *c)
{//path作为当前的路径
struct _finddata_t filefind;
string curr = path + "\*.*";// 修改此处改变搜索条件
int handle;
if ((handle = _findfirst(curr.c_str(), &filefind)) != -1)
{
while (!_findnext(handle, &filefind))//遍历当前目录中的所有文件和文件夹
{
if (strcmp(filefind.name, "..") == 0)
continue;
if ((_A_SUBDIR == filefind.attrib))//是子目录
{
printf("[Dir]: %s
", filefind.name);
curr = path + "\" + filefind.name;
currsion(curr, c);// 递归遍历子目录
}
else
{
char ext[_MAX_EXT];
_splitpath(filefind.name, NULL, NULL, NULL, ext);//获取文件后缀
if ((strcmp(".txt", ext) == 0 && strcmp(c, "*.txt") == 0) || (strcmp(".c", ext) == 0 && strcmp(c, "*.c") == 0))
{
printf("[File]: %s
", filefind.name);
string x = filefind.name;
x = path + "\" + x;//打开当前文件的路径
FILE*fp = fopen(x.data(), "r");
print(fp);
fclose(fp);
}
}
}
_findclose(handle);
}
}
三、收获这一次的结对项目对于我来说是一次不小的挑战,无论是对于文件的熟练操作要求还是图形化界面的初步掌握,我都花了相当的时间去学习、探讨,不同于个人项目,结对项目使我感觉到了协作的重要性,很多次陷入困境的时候,相互探讨往往能对我们在看待问题、分析需求、做出改进等方面有很大帮助,这也决定了团队协作必然是主流。