Remove memtrace 15/232715/1
authorMinje Ahn <minje.ahn@samsung.com>
Thu, 7 May 2020 08:20:52 +0000 (17:20 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Thu, 7 May 2020 08:20:52 +0000 (17:20 +0900)
Change-Id: I674cc520cada75203dbdf58f3b2ab42e0d4f9bd5
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
tests/Makefile.am
tests/mm_file_memtrace_reader.c [deleted file]

index c28a25b663585d555dbdf39774846e6483c0d9e6..66a18a7048e0f4f231c8f9d82b6bf2f670985b7d 100755 (executable)
@@ -26,15 +26,3 @@ else
 mm_file_test_LDADD += $(top_builddir)/codecs/ffmpeg/libmmfile_codecs.la  \
                                          $(top_builddir)/formats/ffmpeg/libmmfile_formats.la
 endif
-
-
-#bin_PROGRAMS += memtrace_reader
-
-#memtrace_reader_SOURCES = mm_file_memtrace_reader.c
-
-#memtrace_reader_CFLAGS = -I/$(srcdir)/include \
-#                    -D_LARGEFILE64_SOURCE \
-#                      -D_FILE_OFFSET_BITS=64
-
-#memtrace_reader_DEPENDENCIES =
-#memtrace_reader_LDADD =
diff --git a/tests/mm_file_memtrace_reader.c b/tests/mm_file_memtrace_reader.c
deleted file mode 100755 (executable)
index 007488a..0000000
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * libmm-fileinfo
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Haejeong Kim <backto.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define LINE_BUFFER_LEN     512
-#define ADDR_BUFFER_LEN     12
-
-#define MALLOC_STRING       "MMALLOC: addr="
-#define FREE_STRING         "MEMFREE: addr="
-#define PREFIX_STRING_LEN   14
-
-
-
-int get_address(char *linebuff, char *ptrbuff)
-{
-       char *head = linebuff;
-
-       if (!linebuff || !ptrbuff)
-               return 0;
-
-       head = head + PREFIX_STRING_LEN;
-
-       while (*head != ' ') {
-               *ptrbuff = *head;
-               ptrbuff++;
-               head++;
-       }
-
-       return 1;
-}
-
-int main(int argc, char *argv[])
-{
-       char linebuffer[LINE_BUFFER_LEN];
-       char ptrbuffer[ADDR_BUFFER_LEN];
-
-       int  alloccount = 0;
-       int  freecount = 0;
-
-       if (argc != 2) {
-               printf("Usage: ./memtrace-read memtrace.mtr\n");
-               exit(1);
-       }
-
-       FILE *fp1 = fopen(argv[1], "r");
-       FILE *fp2 = fopen("memtrace-result.txt", "w");
-
-       if (!fp1 || !fp2) {
-               printf("fail to open %s\n", argv[1]);
-               exit(1);
-       }
-
-       while (1) {
-               memset(linebuffer, 0x00, LINE_BUFFER_LEN);
-               memset(ptrbuffer, 0x00, ADDR_BUFFER_LEN);
-
-               if (fgets(linebuffer, LINE_BUFFER_LEN, fp1) == NULL)
-                       break;
-
-               if (memcmp(MALLOC_STRING, linebuffer, PREFIX_STRING_LEN) == 0) {
-                       get_address(linebuffer, ptrbuffer);
-                       alloccount++;
-               }
-
-               if (memcmp(FREE_STRING, linebuffer, PREFIX_STRING_LEN) == 0) {
-                       get_address(linebuffer, ptrbuffer);
-                       freecount++;
-               }
-       }
-
-       if (alloccount != freecount) {
-               char alloclist[alloccount][ADDR_BUFFER_LEN];
-               int  alloccountlist[alloccount];
-               char freelist[freecount][ADDR_BUFFER_LEN];
-               int  freecountlist[freecount];
-
-               int  i = 0;
-               int  allocindex = 0;
-               int  freeindex = 0;
-               int  totalcount = 0;
-
-               memset(alloclist, 0x00, alloccount * ADDR_BUFFER_LEN);
-               memset(alloccountlist, 0x00, alloccount * 4);
-
-               memset(freelist, 0x00, freecount * ADDR_BUFFER_LEN);
-               memset(freecountlist, 0x00, freecount * 4);
-
-               fseek(fp1, 0, SEEK_SET);
-
-               while (1) {
-                       memset(linebuffer, 0x00, LINE_BUFFER_LEN);
-                       memset(ptrbuffer, 0x00, ADDR_BUFFER_LEN);
-
-                       if (fgets(linebuffer, LINE_BUFFER_LEN, fp1) == NULL)
-                               break;
-
-                       totalcount++;
-                       if (memcmp(MALLOC_STRING, linebuffer, PREFIX_STRING_LEN) == 0) {
-                               int i = 0;
-
-                               get_address(linebuffer, ptrbuffer);
-
-                               for (i = 0; i < alloccount; i++) {
-                                       if (memcmp(ptrbuffer, alloclist[i], strlen(ptrbuffer)) == 0) {
-                                               alloccountlist[i]++;
-                                               break;
-                                       }
-                               }
-
-                               if (i == alloccount) {
-                                       memcpy(alloclist[allocindex], ptrbuffer, strlen(ptrbuffer));
-                                       alloccountlist[allocindex]++;
-                                       allocindex++;
-                               }
-                       }
-
-                       if (memcmp(FREE_STRING, linebuffer, PREFIX_STRING_LEN) == 0) {
-                               int i = 0;
-
-                               get_address(linebuffer, ptrbuffer);
-
-                               for (i = 0; i < freecount; i++) {
-                                       if (memcmp(ptrbuffer, freelist[i], strlen(ptrbuffer)) == 0) {
-                                               freecountlist[i]++;
-                                               break;
-                                       }
-                               }
-
-                               if (i == freecount) {
-                                       memcpy(freelist[freeindex], ptrbuffer, strlen(ptrbuffer));
-                                       freecountlist[freeindex]++;
-                                       freeindex++;
-                               }
-                       }
-               }
-
-               printf("Total: %d mem operation\n", totalcount);
-
-               int i1 = 0, i2 = 0;
-
-
-               fprintf(fp2, "-------------------------------------------------------------\n");
-               fprintf(fp2, "ADDRESS (malloc count, free cout, diff)\n");
-
-
-               for (i1 = 0; i1 < allocindex; i1++) {
-                       for (i2 = 0; i2 < freeindex; i2++) {
-                               if (strcmp(alloclist[i1], freelist[i2]) == 0) {
-                                       if (strcmp(alloclist[i1], "Checked") != 0)
-                                               break;
-                               }
-                       }
-
-                       if (i2 == freeindex) {
-                               /*    fprintf (fp2, "%s error\n", alloclist[i1]); */
-                       } else {
-                               fprintf(fp2, "%s %12d %8d %8d\n", alloclist[i1], alloccountlist[i1], freecountlist[i2], alloccountlist[i1] - freecountlist[i2]);
-                               strcpy(alloclist[i1], "Checked");
-                               strcpy(freelist[i2], "Checked");
-                       }
-               }
-
-               for (i = 0; i < allocindex; i++) {
-                       if (strcmp(alloclist[i], "Checked") != 0)
-                               fprintf(fp2, "%s error\n", alloclist[i]);
-               }
-
-               for (i = 0; i < freeindex; i++) {
-                       if (strcmp(freelist[i], "Checked") != 0)
-                               fprintf(fp2, "%s error\n", freelist[i]);
-               }
-       }
-
-       fclose(fp1);
-       fclose(fp2);
-
-       exit(0);
-}
-