第一次课程作业项目报告
一.实验内容
要求
1. 对源文件(*.txt,*.cpp,*.h,*.cs,*.html,*.js,*.java,*.py,*.php等)统计字符数、单词数、行数、词频,统计结果以指定格式输出到默认文件中,以及其他扩展功能,并能够快速地处理多个文件。
2. 使用性能测试工具进行分析,找到性能的瓶颈并改进
3. 对代码进行质量分析,消除所有警告
4. 设计10个测试样例用于测试,确保程序正常运行(例如:空文件,只包含一个词的文件,只有一行的文件,典型文件等等)
5. 使用Github进行代码管理
6. 撰写博客
基本功能
1. 统计文件的字符数
2. 统计文件的单词总数
3. 统计文件的总行数
4. 统计文件中各单词的出现次数
5. 对给定文件夹及其递归子文件夹下的所有文件进行统计
6. 统计两个单词(词组)在一起的频率,输出频率最高的前10个。
7. 在Linux系统下,进行性能分析,过程写到blog中(附加题)
二.PSP表格
| 预计用时/h | 实际用时/h |
Planning | 0.5 | 1 |
· Analysis | 1 | 1 |
· Design | 1 | 2 |
· Design Review | 0.5 | 0.5 |
· Coding Standard | 0.5 | 1 |
· Coding | 10 | 12 |
· Code Review | 1 | 4 |
· Test | 1 | 3 |
Reporting | 1.5 | 2 |
· Test Report | 1 | 1.5 |
·Summary | 0.5 | 0.5 |
合计 | 17 | 28.5 |
三.代码
Windows版
// ConsoleApplication2.cpp: 定义控制台应用程序的入口点。 // /*总思路:hashnum存储字符串的哈希值,用Hash的下标来表示,Hash此下标中存 着字符指针的下标(即W[n]中的n),同时Fren[hashnum]存储对应Hash[hashnum]的频率 所以最终输出时对Fren数组进行查找出最大的,然后找出对应Hash表中的字符指针下表*/ #include "stdafx.h" #include "iostream" #include "string" #include "string.h" #include <cstring> // for strcpy(), strcat() #include <io.h> #define strcasecmp _stricmp #define N 50331553 #define LONGMAX 1024 FILE *fin, *fout, *fin1, *fin2, *fin3; char *W[20000000]; char *PH[20000000]; char *PL[20000000]; int Hash[N] = { 0 }; int Fren[N] = { 0 }; int HashP[N] = { 0 }; int FrenP[N] = { 0 }; long int chnum = 0, linenum = 0, wordsnum = 0; int pp = 0, ii = 0; using namespace std; unsigned int BKDRHash(char *str); unsigned int BKDRHashP(char *str1, char *str2); bool Ascll(char c); bool isc(char c); bool is(char c); void charnum(void); void wordnum(void); int Insert(char *str, int n); int InsertP(char *str1, char *str2, int n); bool Compare(char *str1, char *str2); void listFiles(const char * dir); int FindWord(char *str); int FindWord(char *str) { unsigned int hashnum; int p; hashnum = BKDRHash(str); int a; p = Hash[hashnum]; if (W[p] == NULL) return 0; a = Compare(str, W[p]); while (a==0) { hashnum++; p = Hash[hashnum]; a = Compare(str, W[p]); } return p; } unsigned int BKDRHashP(char *str1, char *str2) { unsigned int hashnum1; unsigned int hashnum2; hashnum1 = BKDRHash(str1); hashnum2 = BKDRHash(str2); return((hashnum1 + hashnum2) % N); } int InsertP(char *str1, char *str2, int n) { if (n == 0) return 0; int hashnum; int p, a, b; hashnum = BKDRHashP(str1, str2); while (FrenP[hashnum]>0) { p = HashP[hashnum]; a = Compare(PH[p], str1); b = Compare(PL[p], str2); if (a == 1 && b == 1) { FrenP[hashnum]++; return 1; } else hashnum = (hashnum + 1) % N; } HashP[hashnum] = n; FrenP[hashnum] = 1; return 0; } bool Compare(char *str1, char *str2) { char new1[LONGMAX], new2[LONGMAX]; int n1, n2, i, n; n1 = strlen(str1); if (str2 == NULL) return false; n2 = strlen(str2); n1--; n2--; while ((int)str1[n1] > 47 && (int)str1[n1] < 58) { n1--; } for (i = 0; i < n1 + 1; i++) new1[i] = str1[i]; new1[n1 + 1] = '\0'; //去掉str1数字结尾 while ((int)str2[n2] > 47 && (int)str2[n2] < 58) { n2--; } for (i = 0; i < n2 + 1; i++) new2[i] = str2[i]; new2[n2 + 1] = '\0'; //去掉str2数字结尾 n = strcasecmp(new1, new2); if (n == 0) return true; else return false; } int Insert(char *str, int n) { int hashnum; int p, a, length; hashnum = BKDRHash(str); //printf("%d",hashnum); while (Fren[hashnum]>0) { //printf("%s\n", str); p = Hash[hashnum]; a = Compare(W[p], str); //printf("%d", a); if (a == 1) { if (strcmp(W[p], str)> 0) { length = strlen(str); length++; free(W[p]); W[p] = (char *)malloc(length * sizeof(char)); strcpy_s(W[p], length, str); Fren[hashnum]++; return 1; } Fren[hashnum]++; return 1; } else hashnum = (hashnum + 1) % N; } Hash[hashnum] = n; Fren[hashnum] = 1; return 0; } unsigned int BKDRHash(char *str) { int n, i; unsigned int seed = 131; // 31 131 1313 13131 131313 etc.. unsigned int hash = 0; char copy[LONGMAX]; n = strlen(str); n--; while ((int)str[n] > 47 && (int)str[n] < 58) { n--; } for (i = 0; i < n + 1; i++) copy[i] = str[i]; copy[n + 1] = '\0'; //去掉数字结尾 n = 0; while (copy[n] != '\0') { if ((int)copy[n] > 96 && (int)copy[n] < 123) copy[n] = copy[n] - 32; hash = hash * seed + copy[n]; n++; } return ((hash & 0x7FFFFFFF) % N);//N为一个大质数 } bool Ascll(char c) { if ((int)c >= 32 && (int)c <= 126) return true; else return false; } bool isc(char c) { if (((int)c > 47 && (int)c < 58) || ((int)c > 64 && (int)c < 91) || ((int)c > 96 && (int)c < 123)) return true; else return false; } bool is(char c) { if (((int)c > 64 && (int)c < 91) || ((int)c > 96 && (int)c < 123)) return true; else return false; } void charnum(void) { char ch; while ((ch = fgetc(fin)) != EOF) { if (Ascll(ch)) chnum++; if (ch == '\n') linenum++; } linenum++; } void wordnum(void) { //int hashnum; char ch, ch1, ch2, ch3; int k, wordmax = 0, sign, signP = 0, length;//p,q与i,k相对应是词组的下标 unsigned int hashmax = 0; ch2 = fgetc(fin2); ch1 = fgetc(fin1); ch1 = fgetc(fin1); ch = fgetc(fin); ch = fgetc(fin); ch = fgetc(fin); ch3 = fgetc(fin3); //putchar(ch3); ch2 = fgetc(fin2); //putchar(ch2); ch1 = fgetc(fin1); //putchar(ch1); ch = fgetc(fin); //putchar(ch) ; char Get[LONGMAX]; PH[pp] = (char *)malloc(sizeof(char)); PH[pp][0] = '\0'; while (ch != EOF) { if (is(ch1) && is(ch2) && is(ch3) && is(ch)) { wordsnum++; k = 0; Get[k] = ch3; k++; Get[k] = ch2; k++; Get[k] = ch1; k++; while (isc(ch)) { Get[k] = ch; k++; ch3 = fgetc(fin3); ch2 = fgetc(fin2); ch1 = fgetc(fin1); ch = fgetc(fin); } Get[k] = '\0'; length = strlen(Get) + 1; W[ii] = (char *)malloc(length * sizeof(char)); PL[pp] = (char *)malloc(length * sizeof(char)); PH[pp + 1] = (char *)malloc(length * sizeof(char)); strcpy_s(W[ii], length, Get); strcpy_s(PL[pp], length, Get); strcpy_s(PH[pp + 1], length, Get); sign = Insert(W[ii], ii); if (sign == 1) { free(W[ii]); } else ii++; signP = InsertP(PH[pp], PL[pp], pp); if (signP == 1) { free(PH[pp]); free(PL[pp]); PH[pp] = (char *)malloc(length * sizeof(char)); strcpy_s(PH[pp], length, Get); free(PH[pp + 1]); } else pp++; } ch3 = fgetc(fin3); ch2 = fgetc(fin2); ch1 = fgetc(fin1); ch = fgetc(fin); } fclose(fin1); fclose(fin2); fclose(fin3); } void listFiles(const char * dir) { char dirNew[200]; char copy[200]; char c[200]; strcpy_s(dirNew,200,dir); strcat_s(dirNew,200,"\\*.*"); // 在目录后面加上"\\*.*"进行第一次搜索 int length; int handle; _finddata_t findData; handle = _findfirst(dirNew, &findData); if (handle == -1) // 检查是否成功 return; do { if (findData.attrib & _A_SUBDIR) { if (strcmp(findData.name, ".") == 0 || strcmp(findData.name, "..") == 0) continue; //cout << findData.name << "\t<dir>\n"; strcpy_s(c, 200, dir); strcat_s(c, 200, "\\"); strcat_s(c, 200, findData.name); listFiles(c); } else { cout << findData.name << "\t" << findData.size << " bytes.\n"; errno_t err; strcpy_s(copy,200,dirNew); length = strlen(copy); copy[length - 3] = '\0'; strcat_s(copy, 200, findData.name); err = fopen_s(&fin,copy,"r"); charnum(); rewind(fin); err = fopen_s(&fin1, copy, "r"); err = fopen_s(&fin2, copy, "r"); err = fopen_s(&fin3, copy, "r"); wordnum(); fclose(fin); } } while (_findnext(handle, &findData) == 0); _findclose(handle); // 关闭搜索句柄 } int main(int argc,char *argv[]) { int i; int err; //C:\Users\LHR\source\repos\ConsoleApplication2\Release\ConsoleApplication2.exe char dir[200]; char A[10][2*LONGMAX]; int n1; cout << "Enter a directory: "; cin.getline(dir, 200); //strcpy_s(dir,200,argv[1]); listFiles(dir); err = fopen_s(&fout, "result.txt", "w"); fprintf( fout,"char_number :%d \nline_number :%d\n", chnum, linenum); fprintf( fout,"word_number :%d\n\n", wordsnum); int x, y, r1, r2; for (x = 0; x<10; x++) for (y = x + 1; y < N; y++) if (FrenP[x] < FrenP[y]) { r1 = FrenP[x]; FrenP[x] = FrenP[y]; FrenP[y] = r1; r2 = HashP[x]; HashP[x] = HashP[y]; HashP[y] = r2; } if (W[FindWord(PH[HashP[9]])]) { for (i = 0; i < 10; i++) { n1 = strlen(W[FindWord(PH[HashP[i]])]); strcpy_s(A[i], 2 * LONGMAX, W[FindWord(PH[HashP[i]])]); A[i][n1] = ' '; A[i][n1 + 1] = '\0'; strcat_s(A[i], 200, W[FindWord(PL[HashP[i]])]); } } for (x = 0; x<10; x++) for (y = x + 1; y < N; y++) if (Fren[x] < Fren[y]) { r1 = Fren[x]; Fren[x] = Fren[y]; Fren[y] = r1; r2 = Hash[x]; Hash[x] = Hash[y]; Hash[y] = r2; } fprintf(fout, "the top ten frequency of word :\n"); for (i = 0; i < 10; i++) fprintf(fout,"%s:%d\n", W[Hash[i]], Fren[i]); fprintf(fout, "\n\nthe top ten frequency of phrase:\n"); for(i = 0 ;i < 10;i++) fprintf(fout, "%s:%d\n", A[i], FrenP[i]); fclose(fout); system("pause"); return 0; }
Linux版
#include "iostream" #include <cstring> // for strcpy(), strcat() #include<experimental/filesystem> //#include <io.h> #define N 50331553 #define LONGMAX 1024 FILE *fin, *fout, *fin1, *fin2, *fin3; char *W[20000000]; char *PH[20000000]; char *PL[20000000]; int Hash[N] = { 0 }; int Fren[N] = { 0 }; int HashP[N] = { 0 }; int FrenP[N] = { 0 }; long int chnum = 0, linenum = 0, wordsnum = 0; int pp = 0, ii = 0; using namespace std; unsigned int BKDRHash(char *str); unsigned int BKDRHashP(char *str1, char *str2); bool Ascll(char c); bool isc(char c); bool is(char c); void charnum(void); void wordnum(void); int Insert(char *str, int n); int InsertP(char *str1, char *str2, int n); bool Compare(char *str1, char *str2); void listFiles(const char * dir); int FindWord(char *str); int FindWord(char *str) { unsigned int hashnum; int p; hashnum = BKDRHash(str); int a; p = Hash[hashnum]; if (W[p] == NULL) return 0; a = Compare(str, W[p]); while (a==0) { hashnum++; p = Hash[hashnum]; a = Compare(str, W[p]); } return p; } unsigned int BKDRHashP(char *str1, char *str2) { unsigned int hashnum1; unsigned int hashnum2; hashnum1 = BKDRHash(str1); hashnum2 = BKDRHash(str2); return((hashnum1 + hashnum2) % N); } int InsertP(char *str1, char *str2, int n) { if (n == 0) return 0; int hashnum; int p, a, b, length; hashnum = BKDRHashP(str1, str2); while (FrenP[hashnum]>0) { p = HashP[hashnum]; a = Compare(PH[p], str1); b = Compare(PL[p], str2); if (a == 1 && b == 1) { FrenP[hashnum]++; return 1; } else hashnum = (hashnum + 1) % N; } HashP[hashnum] = n; FrenP[hashnum] = 1; return 0; } bool Compare(char *str1, char *str2) { char new1[LONGMAX], new2[LONGMAX]; int n1, n2, i, n; n1 = strlen(str1); if (str2 == NULL) return false; n2 = strlen(str2); n1--; n2--; while ((int)str1[n1] > 47 && (int)str1[n1] < 58) { n1--; } for (i = 0; i < n1 + 1; i++) new1[i] = str1[i]; new1[n1 + 1] = '\0'; //È¥µôstr1Êý×Ö½áβ while ((int)str2[n2] > 47 && (int)str2[n2] < 58) { n2--; } for (i = 0; i < n2 + 1; i++) new2[i] = str2[i]; new2[n2 + 1] = '\0'; //È¥µôstr2Êý×Ö½áβ n = strcasecmp(new1, new2); if (n == 0) return true; else return false; } int Insert(char *str, int n) { int hashnum; int p, a, length; hashnum = BKDRHash(str); //printf("%d",hashnum); while (Fren[hashnum]>0) { //printf("%s\n", str); p = Hash[hashnum]; a = Compare(W[p], str); //printf("%d", a); if (a == 1) { if (strcmp(W[p], str)> 0) { length = strlen(str); length++; free(W[p]); W[p] = (char *)malloc(length * sizeof(char)); strcpy(W[p], str); Fren[hashnum]++; return 1; } Fren[hashnum]++; return 1; } else hashnum = (hashnum + 1) % N; } Hash[hashnum] = n; Fren[hashnum] = 1; return 0; } unsigned int BKDRHash(char *str) { int n, i; unsigned int seed = 131; // 31 131 1313 13131 131313 etc.. unsigned int hash = 0; char copy[LONGMAX]; n = strlen(str); n--; while ((int)str[n] > 47 && (int)str[n] < 58) { n--; } for (i = 0; i < n + 1; i++) copy[i] = str[i]; copy[n + 1] = '\0'; //È¥µôÊý×Ö½áβ n = 0; while (copy[n] != '\0') { if ((int)copy[n] > 96 && (int)copy[n] < 123) copy[n] = copy[n] - 32; hash = hash * seed + copy[n]; n++; } return ((hash & 0x7FFFFFFF) % N);//NΪһ¸ö´óÖÊÊý } bool Ascll(char c) { if ((int)c >= 32 && (int)c <= 126) return true; else return false; } bool isc(char c) { if (((int)c > 47 && (int)c < 58) || ((int)c > 64 && (int)c < 91) || ((int)c > 96 && (int)c < 123)) return true; else return false; } bool is(char c) { if (((int)c > 64 && (int)c < 91) || ((int)c > 96 && (int)c < 123)) return true; else return false; } void charnum(void) { char ch; while ((ch = fgetc(fin)) != EOF) { if (Ascll(ch)) chnum++; if (ch == '\n') linenum++; } linenum++; } void wordnum(void) { //int hashnum; char ch, ch1, ch2, ch3; int a, k, wordmax = 0, n, sign, signP = 0, length;//p,qÓëi,kÏà¶ÔÓ¦ÊÇ´Ê×éµÄϱê unsigned int hashmax = 0; ch2 = fgetc(fin2); ch1 = fgetc(fin1); ch1 = fgetc(fin1); ch = fgetc(fin); ch = fgetc(fin); ch = fgetc(fin); ch3 = fgetc(fin3); //putchar(ch3); ch2 = fgetc(fin2); //putchar(ch2); ch1 = fgetc(fin1); //putchar(ch1); ch = fgetc(fin); //putchar(ch) ; char Get[LONGMAX]; PH[pp] = (char *)malloc(sizeof(char)); PH[pp][0] = '\0'; while (ch != EOF) { if (is(ch1) && is(ch2) && is(ch3) && is(ch)) { wordsnum++; k = 0; Get[k] = ch3; k++; Get[k] = ch2; k++; Get[k] = ch1; k++; while (isc(ch)) { Get[k] = ch; k++; ch3 = fgetc(fin3); ch2 = fgetc(fin2); ch1 = fgetc(fin1); ch = fgetc(fin); } Get[k] = '\0'; length = strlen(Get) + 1; W[ii] = (char *)malloc(length * sizeof(char)); PL[pp] = (char *)malloc(length * sizeof(char)); PH[pp + 1] = (char *)malloc(length * sizeof(char)); strcpy(W[ii], Get); strcpy(PL[pp], Get); strcpy(PH[pp + 1], Get); sign = Insert(W[ii], ii); if (sign == 1) { free(W[ii]); } else ii++; signP = InsertP(PH[pp], PL[pp], pp); if (signP == 1) { free(PH[pp]); free(PL[pp]); PH[pp] = (char *)malloc(length * sizeof(char)); strcpy(PH[pp], Get); free(PH[pp + 1]); } else pp++; } ch3 = fgetc(fin3); ch2 = fgetc(fin2); ch1 = fgetc(fin1); ch = fgetc(fin); } fclose(fin1); fclose(fin2); fclose(fin3); } void listFiles(const char * dir) { namespace fs=std::experimental::filesystem; string name; for(auto &p: fs::recursive_directory_iterator(dir)) { if(!fs::is_directory(p.path())) { name = p.path(); fin=fopen(name.c_str(),"r"); charnum(); rewind(fin); fin1 = fopen(name.c_str(),"r"); fin2 = fopen(name.c_str(),"r"); fin3 = fopen(name.c_str(),"r"); wordnum(); fclose(fin); printf("%s close\n", name.c_str()); } } } int main(int argc,char *argv[]) { int i; int err; //C:\Users\LHR\source\repos\ConsoleApplication2\Release\ConsoleApplication2.exe char dir[200]; char A[10][2*LONGMAX]; int n1, n2; cout << "Enter a directory: "; //cin.getline(dir, 200); strcpy(dir,argv[1]); listFiles(dir); fout = fopen("result.txt","w"); fprintf( fout,"char_number :%ld \nline_number :%ld\n", chnum, linenum); fprintf( fout,"word_number :%ld\n\n", wordsnum); int x, y, r1, r2; for (x = 0; x<10; x++) for (y = x + 1; y < N; y++) if (FrenP[x] < FrenP[y]) { r1 = FrenP[x]; FrenP[x] = FrenP[y]; FrenP[y] = r1; r2 = HashP[x]; HashP[x] = HashP[y]; HashP[y] = r2; } if (W[FindWord(PH[HashP[9]])]) { for (i = 0; i < 10; i++) { n1 = strlen(W[FindWord(PH[HashP[i]])]); strcpy(A[i], W[FindWord(PH[HashP[i]])]); A[i][n1] = ' '; A[i][n1 + 1] = '\0'; strcat(A[i], W[FindWord(PL[HashP[i]])]); } } for (x = 0; x<10; x++) for (y = x + 1; y < N; y++) if (Fren[x] < Fren[y]) { r1 = Fren[x]; Fren[x] = Fren[y]; Fren[y] = r1; r2 = Hash[x]; Hash[x] = Hash[y]; Hash[y] = r2; } fprintf(fout, "the top ten frequency of word :\n"); for (i = 0; i < 10; i++) fprintf(fout,"%s:%d\n", W[Hash[i]], Fren[i]); fprintf(fout, "\n\nthe top ten frequency of phrase:\n"); for(i = 0 ;i < 10;i++) fprintf(fout, "%s:%d\n", A[i], FrenP[i]); fclose(fout); return 0;
}
实际上Linux与Windows仅仅在遍历文件夹的方式上不同
四.性能分析
Windows:
从上面的数据可以看出代码执行最多的地方主要在与wordnum这个函数里,下面将这个函数放上。
void wordnum(void) { //int hashnum; char ch, ch1, ch2, ch3; int k, wordmax = 0, sign, signP = 0, length;//p,q与i,k相对应是词组的下标 unsigned int hashmax = 0; ch2 = fgetc(fin2); ch1 = fgetc(fin1); ch1 = fgetc(fin1); ch = fgetc(fin); ch = fgetc(fin); ch = fgetc(fin); ch3 = fgetc(fin3); //putchar(ch3); ch2 = fgetc(fin2); //putchar(ch2); ch1 = fgetc(fin1); //putchar(ch1); ch = fgetc(fin); //putchar(ch) ; char Get[LONGMAX]; PH[pp] = (char *)malloc(sizeof(char)); PH[pp][0] = '\0'; while (ch != EOF) { if (is(ch1) && is(ch2) && is(ch3) && is(ch)) { wordsnum++; k = 0; Get[k] = ch3; k++; Get[k] = ch2; k++; Get[k] = ch1; k++; while (isc(ch)) { Get[k] = ch; k++; ch3 = fgetc(fin3); ch2 = fgetc(fin2); ch1 = fgetc(fin1); ch = fgetc(fin); } Get[k] = '\0'; length = strlen(Get) + 1; W[ii] = (char *)malloc(length * sizeof(char)); PL[pp] = (char *)malloc(length * sizeof(char)); PH[pp + 1] = (char *)malloc(length * sizeof(char)); strcpy_s(W[ii], length, Get); strcpy_s(PL[pp], length, Get); strcpy_s(PH[pp + 1], length, Get); sign = Insert(W[ii], ii); if (sign == 1) { free(W[ii]); } else ii++; signP = InsertP(PH[pp], PL[pp], pp); if (signP == 1) { free(PH[pp]); free(PL[pp]); PH[pp] = (char *)malloc(length * sizeof(char)); strcpy_s(PH[pp], length, Get); free(PH[pp + 1]); } else pp++; } ch3 = fgetc(fin3); ch2 = fgetc(fin2); ch1 = fgetc(fin1); ch = fgetc(fin); } fclose(fin1); fclose(fin2); fclose(fin3); }
由于算法思路的问题,我是申请了四个指针,一个接一个指向文本,所以会慢一些,如果改成一个指针的话,会快很多。还有就是HASH函数的问题
Hash函数 | 数据1 | 数据2 | 数据3 | 数据4 | 数据1得分 | 数据2得分 | 数据3得分 | 数据4得分 | 平均分 |
BKDRHash | 2 | 0 | 4774 | 481 | 96.55 | 100 | 90.95 | 82.05 | 92.64 |
APHash | 2 | 3 | 4754 | 493 | 96.55 | 88.46 | 100 | 51.28 | 86.28 |
DJBHash | 2 | 2 | 4975 | 474 | 96.55 | 92.31 | 0 | 100 | 83.43 |
JSHash | 1 | 4 | 4761 | 506 | 100 | 84.62 | 96.83 | 17.95 | 81.94 |
RSHash | 1 | 0 | 4861 | 505 | 100 | 100 | 51.58 | 20.51 | 75.96 |
SDBMHash | 3 | 2 | 4849 | 504 | 93.1 | 92.31 | 57.01 | 23.08 | 72.41 |
PJWHash | 30 | 26 | 4878 | 513 | 0 | 0 | 43.89 | 0 | 21.95 |
ELFHash | 30 | 26 | 4878 | 513 | 0 | 0 | 43.89 | 0 | 21.95 |
这个是有人对不同哈希函数(针对字符串的)分析的表 ,从上面的数据可知,用BKDR哈希函数之最好的选择,因为,对不同的测试数据,他的冲突最少,所以所耗费的时间也最少。
Linux:
这是用Linux下的gprof进行的分析。前面的大致分析和Windows差不多,后面还给出了每个函数总共调用的次数,这样子就明确指出了其中的热点语句,进而优化更简单。
Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls s/call s/call name 27.74 4.78 4.78 16639542 0.00 0.00 InsertP(char*, char*, int) 18.57 7.98 3.20 main 15.61 10.67 2.69 49918655 0.00 0.00 BKDRHash(char*) 12.36 12.80 2.13 16639542 0.00 0.00 Insert(char*, int) 11.03 14.70 1.90 52986355 0.00 0.00 Compare(char*, char*) 6.21 15.77 1.07 1324 0.00 0.01 wordnum() 2.58 16.22 0.45 285888049 0.00 0.00 is(char) 2.29 16.61 0.40 181107572 0.00 0.00 Ascll(char) 2.15 16.98 0.37 1324 0.00 0.00 charnum() 0.70 17.10 0.12 65625900 0.00 0.00 isc(char) 0.58 17.20 0.10 16639541 0.00 0.00 BKDRHashP(char*, char*) 0.06 17.21 0.01 31 0.00 0.00 FindWord(char*) 0.06 17.22 0.01 1 0.01 14.01 listFiles(char const*) 0.06 17.23 0.01 std::experimental::filesystem::v1::__cxx11::_Dir::advance(std::error_code*, std::experimental::filesystem::v1::directory_options) 0.00 17.23 0.00 2774 0.00 0.00 std::experimental::filesystem::v1::__cxx11::directory_entry::path() const 0.00 17.23 0.00 1452 0.00 0.00 bool std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>::owner_before<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>(std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2> const&) const 0.00 17.23 0.00 1452 0.00 0.00 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::_M_less(std::__shared_count<(__gnu_cxx::_Lock_policy)2> const&) const 0.00 17.23 0.00 1452 0.00 0.00 std::less<std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>*>::operator()(std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>* const&, std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>* const&) const 0.00 17.23 0.00 1451 0.00 0.00 std::experimental::filesystem::v1::__cxx11::operator==(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&, std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&) 0.00 17.23 0.00 1451 0.00 0.00 std::experimental::filesystem::v1::__cxx11::operator!=(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&, std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&) 0.00 17.23 0.00 1450 0.00 0.00 std::experimental::filesystem::v1::file_status::type() const 0.00 17.23 0.00 1450 0.00 0.00 std::experimental::filesystem::v1::is_directory(std::experimental::filesystem::v1::file_status) 0.00 17.23 0.00 1450 0.00 0.00 std::experimental::filesystem::v1::is_directory(std::experimental::filesystem::v1::__cxx11::path const&) 0.00 17.23 0.00 1425 0.00 0.00 __gnu_cxx::new_allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>::~new_allocator() 0.00 17.23 0.00 1425 0.00 0.00 std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>::~allocator() 0.00 17.23 0.00 1425 0.00 0.00 void std::_Destroy_aux<false>::__destroy<std::experimental::filesystem::v1::__cxx11::path::_Cmpt*>(std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::experimental::filesystem::v1::__cxx11::path::_Cmpt*) 0.00 17.23 0.00 1425 0.00 0.00 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_Vector_impl::~_Vector_impl() 0.00 17.23 0.00 1425 0.00 0.00 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_M_deallocate(std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, unsigned long) 0.00 17.23 0.00 1425 0.00 0.00 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_M_get_Tp_allocator() 0.00 17.23 0.00 1425 0.00 0.00 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::~_Vector_base() 0.00 17.23 0.00 1425 0.00 0.00 std::vector<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::~vector() 0.00 17.23 0.00 1425 0.00 0.00 void std::_Destroy<std::experimental::filesystem::v1::__cxx11::path::_Cmpt*>(std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::experimental::filesystem::v1::__cxx11::path::_Cmpt*) 0.00 17.23 0.00 1425 0.00 0.00 void std::_Destroy<std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::experimental::filesystem::v1::__cxx11::path::_Cmpt>(std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>&) 0.00 17.23 0.00 1324 0.00 0.00 std::experimental::filesystem::v1::__cxx11::path::operator std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >() const 0.00 17.23 0.00 679 0.00 0.00 std::experimental::filesystem::v1::__cxx11::path::~path() 0.00 17.23 0.00 480 0.00 0.00 __gnu_cxx::new_allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>::deallocate(std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, unsigned long) 0.00 17.23 0.00 480 0.00 0.00 std::allocator_traits<std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::deallocate(std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>&, std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, unsigned long) 0.00 17.23 0.00 2 0.00 0.00 __gthread_active_p() 0.00 17.23 0.00 2 0.00 0.00 __gnu_cxx::__atomic_add_single(int*, int) 0.00 17.23 0.00 2 0.00 0.00 __gnu_cxx::__atomic_add_dispatch(int*, int) 0.00 17.23 0.00 2 0.00 0.00 std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>::shared_ptr(std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack> const&) 0.00 17.23 0.00 2 0.00 0.00 std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>::__shared_ptr(std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2> const&) 0.00 17.23 0.00 2 0.00 0.00 std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::recursive_directory_iterator(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&) 0.00 17.23 0.00 2 0.00 0.00 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count(std::__shared_count<(__gnu_cxx::_Lock_policy)2> const&) 0.00 17.23 0.00 2 0.00 0.00 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count() 0.00 17.23 0.00 2 0.00 0.00 std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_add_ref_copy() 0.00 17.23 0.00 1 0.00 0.00 _GLOBAL__sub_I_fin 0.00 17.23 0.00 1 0.00 0.00 __static_initialization_and_destruction_0(int, int) 0.00 17.23 0.00 1 0.00 0.00 __gnu_cxx::new_allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>::new_allocator() 0.00 17.23 0.00 1 0.00 0.00 std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>::allocator() 0.00 17.23 0.00 1 0.00 0.00 std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>::shared_ptr() 0.00 17.23 0.00 1 0.00 0.00 std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>::shared_ptr(std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>&&) 0.00 17.23 0.00 1 0.00 0.00 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_Vector_impl::_Vector_impl() 0.00 17.23 0.00 1 0.00 0.00 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_Vector_base() 0.00 17.23 0.00 1 0.00 0.00 std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>::__shared_ptr(std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>&&) 0.00 17.23 0.00 1 0.00 0.00 std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>::__shared_ptr() 0.00 17.23 0.00 1 0.00 0.00 std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::recursive_directory_iterator(std::experimental::filesystem::v1::__cxx11::path const&) 0.00 17.23 0.00 1 0.00 0.00 std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::recursive_directory_iterator(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator&&) 0.00 17.23 0.00 1 0.00 0.00 std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::recursive_directory_iterator() 0.00 17.23 0.00 1 0.00 0.00 std::experimental::filesystem::v1::__cxx11::end(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator) 0.00 17.23 0.00 1 0.00 0.00 std::experimental::filesystem::v1::__cxx11::path::_S_convert(char const*, std::experimental::filesystem::v1::__cxx11::path::__null_terminated) 0.00 17.23 0.00 1 0.00 0.00 std::experimental::filesystem::v1::__cxx11::path::__null_terminated std::experimental::filesystem::v1::__cxx11::path::_S_range_end<char const*>(char const*) 0.00 17.23 0.00 1 0.00 0.00 char const* std::experimental::filesystem::v1::__cxx11::path::_S_range_begin<char const*>(char const*) 0.00 17.23 0.00 1 0.00 0.00 std::experimental::filesystem::v1::__cxx11::path::path<char const*, std::experimental::filesystem::v1::__cxx11::path>(char const* const&) 0.00 17.23 0.00 1 0.00 0.00 std::experimental::filesystem::v1::__cxx11::begin(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator) 0.00 17.23 0.00 1 0.00 0.00 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::_M_swap(std::__shared_count<(__gnu_cxx::_Lock_policy)2>&) 0.00 17.23 0.00 1 0.00 0.00 std::vector<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::vector() 0.00 17.23 0.00 1 0.00 0.00 std::remove_reference<std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>&>::type&& std::move<std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>&>(std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>&) % the percentage of the total running time of the time program used by this function. cumulative a running sum of the number of seconds accounted seconds for by this function and those listed above it. self the number of seconds accounted for by this seconds function alone. This is the major sort for this listing. calls the number of times this function was invoked, if this function is profiled, else blank. self the average number of milliseconds spent in this ms/call function per call, if this function is profiled, else blank. total the average number of milliseconds spent in this ms/call function and its descendents per call, if this function is profiled, else blank. name the name of the function. This is the minor sort for this listing. The index shows the location of the function in the gprof listing. If the index is in parenthesis it shows where it would appear in the gprof listing if it were to be printed. Copyright (C) 2012-2015 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. Call graph (explanation follows) granularity: each sample hit covers 2 byte(s) for 0.06% of 17.23 seconds index % time self children called name <spontaneous> [1] 99.9 3.20 14.02 main [1] 0.01 14.00 1/1 listFiles(char const*) [2] 0.01 0.00 31/31 FindWord(char*) [13] ----------------------------------------------- 0.01 14.00 1/1 main [1] [2] 81.3 0.01 14.00 1 listFiles(char const*) [2] 1.07 12.17 1324/1324 wordnum() [3] 0.37 0.40 1324/1324 charnum() [9] 0.00 0.00 2774/2774 std::experimental::filesystem::v1::__cxx11::directory_entry::path() const [21] 0.00 0.00 1451/1451 std::experimental::filesystem::v1::__cxx11::operator!=(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&, std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&) [26] 0.00 0.00 1450/1450 std::experimental::filesystem::v1::is_directory(std::experimental::filesystem::v1::__cxx11::path const&) [29] 0.00 0.00 1324/1324 std::experimental::filesystem::v1::__cxx11::path::operator std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >() const [40] 0.00 0.00 2/2 std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::recursive_directory_iterator(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&) [49] 0.00 0.00 1/1 std::experimental::filesystem::v1::__cxx11::path::path<char const*, std::experimental::filesystem::v1::__cxx11::path>(char const* const&) [70] 0.00 0.00 1/1 std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::recursive_directory_iterator(std::experimental::filesystem::v1::__cxx11::path const&) [63] 0.00 0.00 1/679 std::experimental::filesystem::v1::__cxx11::path::~path() [41] 0.00 0.00 1/1 std::experimental::filesystem::v1::__cxx11::begin(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator) [71] 0.00 0.00 1/1 std::experimental::filesystem::v1::__cxx11::end(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator) [66] ----------------------------------------------- 1.07 12.17 1324/1324 listFiles(char const*) [2] [3] 76.8 1.07 12.17 1324 wordnum() [3] 4.78 3.20 16639542/16639542 InsertP(char*, char*, int) [4] 2.13 1.49 16639542/16639542 Insert(char*, int) [5] 0.45 0.00 285888049/285888049 is(char) [10] 0.12 0.00 65625900/65625900 isc(char) [12] ----------------------------------------------- 4.78 3.20 16639542/16639542 wordnum() [3] [4] 46.3 4.78 3.20 16639542 InsertP(char*, char*, int) [4] 0.10 1.79 16639541/16639541 BKDRHashP(char*, char*) [8] 1.31 0.00 36424134/52986355 Compare(char*, char*) [7] ----------------------------------------------- 2.13 1.49 16639542/16639542 wordnum() [3] [5] 21.0 2.13 1.49 16639542 Insert(char*, int) [5] 0.90 0.00 16639542/49918655 BKDRHash(char*) [6] 0.59 0.00 16562190/52986355 Compare(char*, char*) [7] ----------------------------------------------- 0.00 0.00 31/49918655 FindWord(char*) [13] 0.90 0.00 16639542/49918655 Insert(char*, int) [5] 1.79 0.00 33279082/49918655 BKDRHashP(char*, char*) [8] [6] 15.6 2.69 0.00 49918655 BKDRHash(char*) [6] ----------------------------------------------- 0.00 0.00 31/52986355 FindWord(char*) [13] 0.59 0.00 16562190/52986355 Insert(char*, int) [5] 1.31 0.00 36424134/52986355 InsertP(char*, char*, int) [4] [7] 11.0 1.90 0.00 52986355 Compare(char*, char*) [7] ----------------------------------------------- 0.10 1.79 16639541/16639541 InsertP(char*, char*, int) [4] [8] 11.0 0.10 1.79 16639541 BKDRHashP(char*, char*) [8] 1.79 0.00 33279082/49918655 BKDRHash(char*) [6] ----------------------------------------------- 0.37 0.40 1324/1324 listFiles(char const*) [2] [9] 4.4 0.37 0.40 1324 charnum() [9] 0.40 0.00 181107572/181107572 Ascll(char) [11] ----------------------------------------------- 0.45 0.00 285888049/285888049 wordnum() [3] [10] 2.6 0.45 0.00 285888049 is(char) [10] ----------------------------------------------- 0.40 0.00 181107572/181107572 charnum() [9] [11] 2.3 0.40 0.00 181107572 Ascll(char) [11] ----------------------------------------------- 0.12 0.00 65625900/65625900 wordnum() [3] [12] 0.7 0.12 0.00 65625900 isc(char) [12] ----------------------------------------------- 0.01 0.00 31/31 main [1] [13] 0.1 0.01 0.00 31 FindWord(char*) [13] 0.00 0.00 31/49918655 BKDRHash(char*) [6] 0.00 0.00 31/52986355 Compare(char*, char*) [7] ----------------------------------------------- <spontaneous> [14] 0.1 0.01 0.00 std::experimental::filesystem::v1::__cxx11::_Dir::advance(std::error_code*, std::experimental::filesystem::v1::directory_options) [14] 0.00 0.00 746/1425 std::vector<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::~vector() [37] ----------------------------------------------- 0.00 0.00 2774/2774 listFiles(char const*) [2] [21] 0.0 0.00 0.00 2774 std::experimental::filesystem::v1::__cxx11::directory_entry::path() const [21] ----------------------------------------------- 0.00 0.00 1452/1452 std::experimental::filesystem::v1::__cxx11::operator==(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&, std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&) [25] [22] 0.0 0.00 0.00 1452 bool std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>::owner_before<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>(std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2> const&) const [22] 0.00 0.00 1452/1452 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::_M_less(std::__shared_count<(__gnu_cxx::_Lock_policy)2> const&) const [23] ----------------------------------------------- 0.00 0.00 1452/1452 bool std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>::owner_before<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>(std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2> const&) const [22] [23] 0.0 0.00 0.00 1452 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::_M_less(std::__shared_count<(__gnu_cxx::_Lock_policy)2> const&) const [23] 0.00 0.00 1452/1452 std::less<std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>*>::operator()(std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>* const&, std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>* const&) const [24] ----------------------------------------------- 0.00 0.00 1452/1452 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::_M_less(std::__shared_count<(__gnu_cxx::_Lock_policy)2> const&) const [23] [24] 0.0 0.00 0.00 1452 std::less<std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>*>::operator()(std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>* const&, std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>* const&) const [24] ----------------------------------------------- 0.00 0.00 1451/1451 std::experimental::filesystem::v1::__cxx11::operator!=(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&, std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&) [26] [25] 0.0 0.00 0.00 1451 std::experimental::filesystem::v1::__cxx11::operator==(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&, std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&) [25] 0.00 0.00 1452/1452 bool std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>::owner_before<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>(std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2> const&) const [22] ----------------------------------------------- 0.00 0.00 1451/1451 listFiles(char const*) [2] [26] 0.0 0.00 0.00 1451 std::experimental::filesystem::v1::__cxx11::operator!=(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&, std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&) [26] 0.00 0.00 1451/1451 std::experimental::filesystem::v1::__cxx11::operator==(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&, std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&) [25] ----------------------------------------------- 0.00 0.00 1450/1450 std::experimental::filesystem::v1::is_directory(std::experimental::filesystem::v1::file_status) [28] [27] 0.0 0.00 0.00 1450 std::experimental::filesystem::v1::file_status::type() const [27] ----------------------------------------------- 0.00 0.00 1450/1450 std::experimental::filesystem::v1::is_directory(std::experimental::filesystem::v1::__cxx11::path const&) [29] [28] 0.0 0.00 0.00 1450 std::experimental::filesystem::v1::is_directory(std::experimental::filesystem::v1::file_status) [28] 0.00 0.00 1450/1450 std::experimental::filesystem::v1::file_status::type() const [27] ----------------------------------------------- 0.00 0.00 1450/1450 listFiles(char const*) [2] [29] 0.0 0.00 0.00 1450 std::experimental::filesystem::v1::is_directory(std::experimental::filesystem::v1::__cxx11::path const&) [29] 0.00 0.00 1450/1450 std::experimental::filesystem::v1::is_directory(std::experimental::filesystem::v1::file_status) [28] ----------------------------------------------- 0.00 0.00 1425/1425 std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>::~allocator() [31] [30] 0.0 0.00 0.00 1425 __gnu_cxx::new_allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>::~new_allocator() [30] ----------------------------------------------- 0.00 0.00 1425/1425 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_Vector_impl::~_Vector_impl() [33] [31] 0.0 0.00 0.00 1425 std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>::~allocator() [31] 0.00 0.00 1425/1425 __gnu_cxx::new_allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>::~new_allocator() [30] ----------------------------------------------- 0.00 0.00 1425/1425 void std::_Destroy<std::experimental::filesystem::v1::__cxx11::path::_Cmpt*>(std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::experimental::filesystem::v1::__cxx11::path::_Cmpt*) [38] [32] 0.0 0.00 0.00 1425 void std::_Destroy_aux<false>::__destroy<std::experimental::filesystem::v1::__cxx11::path::_Cmpt*>(std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::experimental::filesystem::v1::__cxx11::path::_Cmpt*) [32] ----------------------------------------------- 0.00 0.00 1425/1425 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::~_Vector_base() [36] [33] 0.0 0.00 0.00 1425 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_Vector_impl::~_Vector_impl() [33] 0.00 0.00 1425/1425 std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>::~allocator() [31] ----------------------------------------------- 0.00 0.00 1425/1425 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::~_Vector_base() [36] [34] 0.0 0.00 0.00 1425 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_M_deallocate(std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, unsigned long) [34] 0.00 0.00 480/480 std::allocator_traits<std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::deallocate(std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>&, std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, unsigned long) [43] ----------------------------------------------- 0.00 0.00 1425/1425 std::vector<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::~vector() [37] [35] 0.0 0.00 0.00 1425 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_M_get_Tp_allocator() [35] ----------------------------------------------- 0.00 0.00 1425/1425 std::vector<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::~vector() [37] [36] 0.0 0.00 0.00 1425 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::~_Vector_base() [36] 0.00 0.00 1425/1425 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_M_deallocate(std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, unsigned long) [34] 0.00 0.00 1425/1425 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_Vector_impl::~_Vector_impl() [33] ----------------------------------------------- 0.00 0.00 679/1425 std::experimental::filesystem::v1::__cxx11::path::~path() [41] 0.00 0.00 746/1425 std::experimental::filesystem::v1::__cxx11::_Dir::advance(std::error_code*, std::experimental::filesystem::v1::directory_options) [14] [37] 0.0 0.00 0.00 1425 std::vector<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::~vector() [37] 0.00 0.00 1425/1425 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_M_get_Tp_allocator() [35] 0.00 0.00 1425/1425 void std::_Destroy<std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::experimental::filesystem::v1::__cxx11::path::_Cmpt>(std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>&) [39] 0.00 0.00 1425/1425 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::~_Vector_base() [36] ----------------------------------------------- 0.00 0.00 1425/1425 void std::_Destroy<std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::experimental::filesystem::v1::__cxx11::path::_Cmpt>(std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>&) [39] [38] 0.0 0.00 0.00 1425 void std::_Destroy<std::experimental::filesystem::v1::__cxx11::path::_Cmpt*>(std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::experimental::filesystem::v1::__cxx11::path::_Cmpt*) [38] 0.00 0.00 1425/1425 void std::_Destroy_aux<false>::__destroy<std::experimental::filesystem::v1::__cxx11::path::_Cmpt*>(std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::experimental::filesystem::v1::__cxx11::path::_Cmpt*) [32] ----------------------------------------------- 0.00 0.00 1425/1425 std::vector<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::~vector() [37] [39] 0.0 0.00 0.00 1425 void std::_Destroy<std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::experimental::filesystem::v1::__cxx11::path::_Cmpt>(std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>&) [39] 0.00 0.00 1425/1425 void std::_Destroy<std::experimental::filesystem::v1::__cxx11::path::_Cmpt*>(std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::experimental::filesystem::v1::__cxx11::path::_Cmpt*) [38] ----------------------------------------------- 0.00 0.00 1324/1324 listFiles(char const*) [2] [40] 0.0 0.00 0.00 1324 std::experimental::filesystem::v1::__cxx11::path::operator std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >() const [40] ----------------------------------------------- 0.00 0.00 1/679 listFiles(char const*) [2] 0.00 0.00 102/679 std::deque<std::experimental::filesystem::v1::__cxx11::_Dir, std::allocator<std::experimental::filesystem::v1::__cxx11::_Dir> >::_M_pop_back_aux() [219] 0.00 0.00 576/679 std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::increment(std::error_code&) [164] [41] 0.0 0.00 0.00 679 std::experimental::filesystem::v1::__cxx11::path::~path() [41] 0.00 0.00 679/1425 std::vector<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::~vector() [37] ----------------------------------------------- 0.00 0.00 480/480 std::allocator_traits<std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::deallocate(std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>&, std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, unsigned long) [43] [42] 0.0 0.00 0.00 480 __gnu_cxx::new_allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>::deallocate(std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, unsigned long) [42] ----------------------------------------------- 0.00 0.00 480/480 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_M_deallocate(std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, unsigned long) [34] [43] 0.0 0.00 0.00 480 std::allocator_traits<std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::deallocate(std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>&, std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, unsigned long) [43] 0.00 0.00 480/480 __gnu_cxx::new_allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>::deallocate(std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, unsigned long) [42] ----------------------------------------------- 0.00 0.00 2/2 __gnu_cxx::__atomic_add_dispatch(int*, int) [46] [44] 0.0 0.00 0.00 2 __gthread_active_p() [44] ----------------------------------------------- 0.00 0.00 2/2 __gnu_cxx::__atomic_add_dispatch(int*, int) [46] [45] 0.0 0.00 0.00 2 __gnu_cxx::__atomic_add_single(int*, int) [45] ----------------------------------------------- 0.00 0.00 2/2 std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_add_ref_copy() [52] [46] 0.0 0.00 0.00 2 __gnu_cxx::__atomic_add_dispatch(int*, int) [46] 0.00 0.00 2/2 __gthread_active_p() [44] 0.00 0.00 2/2 __gnu_cxx::__atomic_add_single(int*, int) [45] ----------------------------------------------- 0.00 0.00 2/2 std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::recursive_directory_iterator(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&) [49] [47] 0.0 0.00 0.00 2 std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>::shared_ptr(std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack> const&) [47] 0.00 0.00 2/2 std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>::__shared_ptr(std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2> const&) [48] ----------------------------------------------- 0.00 0.00 2/2 std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>::shared_ptr(std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack> const&) [47] [48] 0.0 0.00 0.00 2 std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>::__shared_ptr(std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2> const&) [48] 0.00 0.00 2/2 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count(std::__shared_count<(__gnu_cxx::_Lock_policy)2> const&) [50] ----------------------------------------------- 0.00 0.00 2/2 listFiles(char const*) [2] [49] 0.0 0.00 0.00 2 std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::recursive_directory_iterator(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&) [49] 0.00 0.00 2/2 std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>::shared_ptr(std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack> const&) [47] ----------------------------------------------- 0.00 0.00 2/2 std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>::__shared_ptr(std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2> const&) [48] [50] 0.0 0.00 0.00 2 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count(std::__shared_count<(__gnu_cxx::_Lock_policy)2> const&) [50] 0.00 0.00 2/2 std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_add_ref_copy() [52] ----------------------------------------------- 0.00 0.00 1/2 std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>::__shared_ptr() [62] 0.00 0.00 1/2 std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>::__shared_ptr(std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>&&) [61] [51] 0.0 0.00 0.00 2 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count() [51] ----------------------------------------------- 0.00 0.00 2/2 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count(std::__shared_count<(__gnu_cxx::_Lock_policy)2> const&) [50] [52] 0.0 0.00 0.00 2 std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_add_ref_copy() [52] 0.00 0.00 2/2 __gnu_cxx::__atomic_add_dispatch(int*, int) [46] ----------------------------------------------- 0.00 0.00 1/1 __libc_csu_init [239] [53] 0.0 0.00 0.00 1 _GLOBAL__sub_I_fin [53] 0.00 0.00 1/1 __static_initialization_and_destruction_0(int, int) [54] ----------------------------------------------- 0.00 0.00 1/1 _GLOBAL__sub_I_fin [53] [54] 0.0 0.00 0.00 1 __static_initialization_and_destruction_0(int, int) [54] ----------------------------------------------- 0.00 0.00 1/1 std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>::allocator() [56] [55] 0.0 0.00 0.00 1 __gnu_cxx::new_allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>::new_allocator() [55] ----------------------------------------------- 0.00 0.00 1/1 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_Vector_impl::_Vector_impl() [59] [56] 0.0 0.00 0.00 1 std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>::allocator() [56] 0.00 0.00 1/1 __gnu_cxx::new_allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>::new_allocator() [55] ----------------------------------------------- 0.00 0.00 1/1 std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::recursive_directory_iterator() [65] [57] 0.0 0.00 0.00 1 std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>::shared_ptr() [57] 0.00 0.00 1/1 std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>::__shared_ptr() [62] ----------------------------------------------- 0.00 0.00 1/1 std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::recursive_directory_iterator(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator&&) [64] [58] 0.0 0.00 0.00 1 std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>::shared_ptr(std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>&&) [58] 0.00 0.00 1/1 std::remove_reference<std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>&>::type&& std::move<std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>&>(std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>&) [74] 0.00 0.00 1/1 std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>::__shared_ptr(std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>&&) [61] ----------------------------------------------- 0.00 0.00 1/1 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_Vector_base() [60] [59] 0.0 0.00 0.00 1 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_Vector_impl::_Vector_impl() [59] 0.00 0.00 1/1 std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>::allocator() [56] ----------------------------------------------- 0.00 0.00 1/1 std::vector<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::vector() [73] [60] 0.0 0.00 0.00 1 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_Vector_base() [60] 0.00 0.00 1/1 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_Vector_impl::_Vector_impl() [59] ----------------------------------------------- 0.00 0.00 1/1 std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>::shared_ptr(std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>&&) [58] [61] 0.0 0.00 0.00 1 std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>::__shared_ptr(std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>&&) [61] 0.00 0.00 1/2 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count() [51] 0.00 0.00 1/1 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::_M_swap(std::__shared_count<(__gnu_cxx::_Lock_policy)2>&) [72] ----------------------------------------------- 0.00 0.00 1/1 std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>::shared_ptr() [57] [62] 0.0 0.00 0.00 1 std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>::__shared_ptr() [62] 0.00 0.00 1/2 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count() [51] ----------------------------------------------- 0.00 0.00 1/1 listFiles(char const*) [2] [63] 0.0 0.00 0.00 1 std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::recursive_directory_iterator(std::experimental::filesystem::v1::__cxx11::path const&) [63] ----------------------------------------------- 0.00 0.00 1/1 std::experimental::filesystem::v1::__cxx11::begin(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator) [71] [64] 0.0 0.00 0.00 1 std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::recursive_directory_iterator(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator&&) [64] 0.00 0.00 1/1 std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>::shared_ptr(std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>&&) [58] ----------------------------------------------- 0.00 0.00 1/1 std::experimental::filesystem::v1::__cxx11::end(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator) [66] [65] 0.0 0.00 0.00 1 std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::recursive_directory_iterator() [65] 0.00 0.00 1/1 std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>::shared_ptr() [57] ----------------------------------------------- 0.00 0.00 1/1 listFiles(char const*) [2] [66] 0.0 0.00 0.00 1 std::experimental::filesystem::v1::__cxx11::end(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator) [66] 0.00 0.00 1/1 std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::recursive_directory_iterator() [65] ----------------------------------------------- 0.00 0.00 1/1 std::experimental::filesystem::v1::__cxx11::path::path<char const*, std::experimental::filesystem::v1::__cxx11::path>(char const* const&) [70] [67] 0.0 0.00 0.00 1 std::experimental::filesystem::v1::__cxx11::path::_S_convert(char const*, std::experimental::filesystem::v1::__cxx11::path::__null_terminated) [67] ----------------------------------------------- 0.00 0.00 1/1 std::experimental::filesystem::v1::__cxx11::path::path<char const*, std::experimental::filesystem::v1::__cxx11::path>(char const* const&) [70] [68] 0.0 0.00 0.00 1 std::experimental::filesystem::v1::__cxx11::path::__null_terminated std::experimental::filesystem::v1::__cxx11::path::_S_range_end<char const*>(char const*) [68] ----------------------------------------------- 0.00 0.00 1/1 std::experimental::filesystem::v1::__cxx11::path::path<char const*, std::experimental::filesystem::v1::__cxx11::path>(char const* const&) [70] [69] 0.0 0.00 0.00 1 char const* std::experimental::filesystem::v1::__cxx11::path::_S_range_begin<char const*>(char const*) [69] ----------------------------------------------- 0.00 0.00 1/1 listFiles(char const*) [2] [70] 0.0 0.00 0.00 1 std::experimental::filesystem::v1::__cxx11::path::path<char const*, std::experimental::filesystem::v1::__cxx11::path>(char const* const&) [70] 0.00 0.00 1/1 std::experimental::filesystem::v1::__cxx11::path::__null_terminated std::experimental::filesystem::v1::__cxx11::path::_S_range_end<char const*>(char const*) [68] 0.00 0.00 1/1 char const* std::experimental::filesystem::v1::__cxx11::path::_S_range_begin<char const*>(char const*) [69] 0.00 0.00 1/1 std::experimental::filesystem::v1::__cxx11::path::_S_convert(char const*, std::experimental::filesystem::v1::__cxx11::path::__null_terminated) [67] 0.00 0.00 1/1 std::vector<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::vector() [73] ----------------------------------------------- 0.00 0.00 1/1 listFiles(char const*) [2] [71] 0.0 0.00 0.00 1 std::experimental::filesystem::v1::__cxx11::begin(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator) [71] 0.00 0.00 1/1 std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::recursive_directory_iterator(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator&&) [64] ----------------------------------------------- 0.00 0.00 1/1 std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>::__shared_ptr(std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>&&) [61] [72] 0.0 0.00 0.00 1 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::_M_swap(std::__shared_count<(__gnu_cxx::_Lock_policy)2>&) [72] ----------------------------------------------- 0.00 0.00 1/1 std::experimental::filesystem::v1::__cxx11::path::path<char const*, std::experimental::filesystem::v1::__cxx11::path>(char const* const&) [70] [73] 0.0 0.00 0.00 1 std::vector<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::vector() [73] 0.00 0.00 1/1 std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_Vector_base() [60] ----------------------------------------------- 0.00 0.00 1/1 std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>::shared_ptr(std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>&&) [58] [74] 0.0 0.00 0.00 1 std::remove_reference<std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>&>::type&& std::move<std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>&>(std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>&) [74] ----------------------------------------------- This table describes the call tree of the program, and was sorted by the total amount of time spent in each function and its children. Each entry in this table consists of several lines. The line with the index number at the left hand margin lists the current function. The lines above it list the functions that called this function, and the lines below it list the functions this one called. This line lists: index A unique number given to each element of the table. Index numbers are sorted numerically. The index number is printed next to every function name so it is easier to look up where the function is in the table. % time This is the percentage of the `total' time that was spent in this function and its children. Note that due to different viewpoints, functions excluded by options, etc, these numbers will NOT add up to 100%. self This is the total amount of time spent in this function. children This is the total amount of time propagated into this function by its children. called This is the number of times the function was called. If the function called itself recursively, the number only includes non-recursive calls, and is followed by a `+' and the number of recursive calls. name The name of the current function. The index number is printed after it. If the function is a member of a cycle, the cycle number is printed between the function's name and the index number. For the function's parents, the fields have the following meanings: self This is the amount of time that was propagated directly from the function into this parent. children This is the amount of time that was propagated from the function's children into this parent. called This is the number of times this parent called the function `/' the total number of times the function was called. Recursive calls to the function are not included in the number after the `/'. name This is the name of the parent. The parent's index number is printed after it. If the parent is a member of a cycle, the cycle number is printed between the name and the index number. If the parents of the function cannot be determined, the word `<spontaneous>' is printed in the `name' field, and all the other fields are blank. For the function's children, the fields have the following meanings: self This is the amount of time that was propagated directly from the child into the function. children This is the amount of time that was propagated from the child's children to the function. called This is the number of times the function called this child `/' the total number of times the child was called. Recursive calls by the child are not listed in the number after the `/'. name This is the name of the child. The child's index number is printed after it. If the child is a member of a cycle, the cycle number is printed between the name and the index number. If there are any cycles (circles) in the call graph, there is an entry for the cycle-as-a-whole. This entry shows who called the cycle (as parents) and the members of the cycle (as children.) The `+' recursive calls entry shows the number of function calls that were internal to the cycle, and the calls entry for each member shows, for that member, how many times it was called from other members of the cycle. Copyright (C) 2012-2015 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. Index by function name [53] _GLOBAL__sub_I_fin [40] std::experimental::filesystem::v1::__cxx11::path::operator std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >() const [65] std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::recursive_directory_iterator() [10] is(char) [23] std::__shared_count<(__gnu_cxx::_Lock_policy)2>::_M_less(std::__shared_count<(__gnu_cxx::_Lock_policy)2> const&) const [66] std::experimental::filesystem::v1::__cxx11::end(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator) [12] isc(char) [24] std::less<std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>*>::operator()(std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>* const&, std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>* const&) const [14] std::experimental::filesystem::v1::__cxx11::_Dir::advance(std::error_code*, std::experimental::filesystem::v1::directory_options) [54] __static_initialization_and_destruction_0(int, int) [56] std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>::allocator() [67] std::experimental::filesystem::v1::__cxx11::path::_S_convert(char const*, std::experimental::filesystem::v1::__cxx11::path::__null_terminated) [11] Ascll(char) [31] std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>::~allocator() [68] std::experimental::filesystem::v1::__cxx11::path::__null_terminated std::experimental::filesystem::v1::__cxx11::path::_S_range_end<char const*>(char const*) [5] Insert(char*, int) [47] std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>::shared_ptr(std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack> const&) [69] char const* std::experimental::filesystem::v1::__cxx11::path::_S_range_begin<char const*>(char const*) [7] Compare(char*, char*) [57] std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>::shared_ptr() [70] std::experimental::filesystem::v1::__cxx11::path::path<char const*, std::experimental::filesystem::v1::__cxx11::path>(char const* const&) [4] InsertP(char*, char*, int) [58] std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>::shared_ptr(std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>&&) [41] std::experimental::filesystem::v1::__cxx11::path::~path() [9] charnum() [32] void std::_Destroy_aux<false>::__destroy<std::experimental::filesystem::v1::__cxx11::path::_Cmpt*>(std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::experimental::filesystem::v1::__cxx11::path::_Cmpt*) [71] std::experimental::filesystem::v1::__cxx11::begin(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator) [3] wordnum() [59] std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_Vector_impl::_Vector_impl() [25] std::experimental::filesystem::v1::__cxx11::operator==(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&, std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&) [6] BKDRHash(char*) [33] std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_Vector_impl::~_Vector_impl() [26] std::experimental::filesystem::v1::__cxx11::operator!=(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&, std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&) [13] FindWord(char*) [34] std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_M_deallocate(std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, unsigned long) [72] std::__shared_count<(__gnu_cxx::_Lock_policy)2>::_M_swap(std::__shared_count<(__gnu_cxx::_Lock_policy)2>&) [8] BKDRHashP(char*, char*) [35] std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_M_get_Tp_allocator() [50] std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count(std::__shared_count<(__gnu_cxx::_Lock_policy)2> const&) [2] listFiles(char const*) [60] std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_Vector_base() [51] std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count() [44] __gthread_active_p() [36] std::_Vector_base<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::~_Vector_base() [52] std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_add_ref_copy() [42] __gnu_cxx::new_allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>::deallocate(std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, unsigned long) [61] std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>::__shared_ptr(std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>&&) [43] std::allocator_traits<std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::deallocate(std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>&, std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, unsigned long) [55] __gnu_cxx::new_allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>::new_allocator() [48] std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>::__shared_ptr(std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2> const&) [73] std::vector<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::vector() [30] __gnu_cxx::new_allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>::~new_allocator() [62] std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>::__shared_ptr() [37] std::vector<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::~vector() [45] __gnu_cxx::__atomic_add_single(int*, int) [28] std::experimental::filesystem::v1::is_directory(std::experimental::filesystem::v1::file_status) [74] std::remove_reference<std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>&>::type&& std::move<std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>&>(std::shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>&) [46] __gnu_cxx::__atomic_add_dispatch(int*, int) [29] std::experimental::filesystem::v1::is_directory(std::experimental::filesystem::v1::__cxx11::path const&) [38] void std::_Destroy<std::experimental::filesystem::v1::__cxx11::path::_Cmpt*>(std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::experimental::filesystem::v1::__cxx11::path::_Cmpt*) [22] bool std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2>::owner_before<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack>(std::__shared_ptr<std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::_Dir_stack, (__gnu_cxx::_Lock_policy)2> const&) const [63] std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::recursive_directory_iterator(std::experimental::filesystem::v1::__cxx11::path const&) [39] void std::_Destroy<std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::experimental::filesystem::v1::__cxx11::path::_Cmpt>(std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt>&) [27] std::experimental::filesystem::v1::file_status::type() const [49] std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::recursive_directory_iterator(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator const&) [1] main [21] std::experimental::filesystem::v1::__cxx11::directory_entry::path() const [64] std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator::recursive_directory_iterator(std::experimental::filesystem::v1::__cxx11::recursive_directory_iterator&&)
五.结果测试
这里只放三种特殊测试结果,和一个文件夹测试结果(文本测试了很多次,本质是一样的)
1.空文本
2.只有三个字符,不构成单词
app
3.非空但是不同单词数少于10个
apple Apple apple Apple apple Apple apple Apple apple Apple apple Apple
助教的答案:
char_number :173654417 line_number :2278666 word_number :16629955 the top ten frequency of word : THAT 259186 SAID 208861 CLASS 192004 HARRY 184732 WITH 158745 THIS 152454 THEY 145945 Span 116118 HAVE 107383 FROM 105494 the top ten frequency of phrase : Span CLASS 62861 THAT GOOD 61427 Span Span 41286 CLASS Reference 31289 Reference INTERNAL 26668 INTERNAL href 26668 SAID HARRY 24981 CLASS Span 23146 href LEAP 22569 SAID HERMIONE 19193
Windows下的测试结果:
char_number :173654585 line_number :2278522 word_number :16639525 the top ten frequency of word : THAT:259186 SAID:208861 CLASS:192004 HARRY:184732 WITH:158745 THIS:152454 THEY:145945 Span:116118 HAVE:107383 FROM:105494 the top ten frequency of phrase: Span CLASS:62861 THAT GOOD:61427 Span Span:41286 CLASS Reference:31289 INTERNAL href:26668 Reference INTERNAL:26668 SAID HARRY:24981 CLASS Span:23146 href LEAP:22569 SAID HERMIONE:19193
Linux下的测试结果:
char_number:173654762 line_number:2278529 word_number:16639526 the top ten frequency of word: THAT 259187 SAID 208862 CLASS 192005 HARRY 184733 WITH 158746 THIS 152455 THEY 145946 Span 116119 HAVE 107384 FROM 105495 the top ten frequency of phrase: Span CLASS 62861 THAT GOOD 61427 Span Span 41286 CLASS Reference 31289 INTERNAL href 26668 Reference INTERNAL 26668 SAID HARRY 24981 CLASS Span 23146 href LEAP 22569 SAID HERMIONE 19193
从结果可以看出基本前三项结果都和助教的不一样,有一些差异,后面输出的单词,词组都与助教保持一致。而且同样的程序在Linux和Windows下跑的结果也不尽相同,这是应该是由于二者字符的不同。(Linux结果比Windows多一是因为把Result.txt也跑了一遍,减去一结果是一样的)
六.收获及反思
这次作业锻炼了我的写代码能力,让我学习到了一些新的工具的使用以及自己亲身操作了新装的ubuntu。这次作业我做了很久,原因有很多,首先自身写的代码太少,代码漏洞太多,其次没有规划好时间,浪费了很多时间在debug上,其实在遇到问题时可以去请教别人的。所以以后在进行项目的时候,前面一定要规划好自己的时间,这样在后面就不会像我这次一样好几天忙到凌晨两三点。