Modify version string to post-release version 0.18.101
[gmpc.git] / test / MetaDataCache / mtc_test.c
blob763d8d91504b58e875f434dde769ebd32e5d1fc4
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <glib.h>
4 #include <libmpd/libmpd.h>
5 #include "gmpc-meta-watcher.h"
6 #include "gmpc-connection.h"
7 #include "metadata.h"
8 #include "metadata-cache.h"
10 GObject *config = NULL;
11 GmpcMetaWatcher *gmw = NULL;
12 GObject *connection = NULL;
14 void playlist3_show_error_message()
19 char *artists[] = {
20 "Eric Clapton",
21 "Clapton, Eric",
22 "B.B. King",
23 "Room Eleven",
24 "James Brown",
25 "Brown, James",
26 "10cc",
27 "2Pac",
28 "Pantera",
29 "Pärt, Arvo",
30 "XERSDRXER"
32 int main(int argc, char **argv)
34 long a;
35 GTimeVal current,now;
36 MetaDataResult result;
37 int i=0,j=1000;
38 // g_type_init();
40 g_get_current_time(&current);
41 metadata_cache_init();
42 g_get_current_time(&now);
43 a = now.tv_usec - current.tv_usec;
44 printf("elapsed open db: %li us\n", (a<0)?1-a:a);
45 current = now;
46 for(;j>0;j--)
48 for(i=0;i<11;i++)
50 MetaData *met = NULL;
51 mpd_Song *song = mpd_newSong();
52 song->artist = g_strdup(artists[i]);
53 result = meta_data_get_from_cache(song, META_ARTIST_ART, &met);
54 if(met) meta_data_free(met);
56 mpd_freeSong(song);
60 g_get_current_time(&now);
61 a = now.tv_usec - current.tv_usec;
62 printf("elapsed 10.000 queries: %li us\n", (a<0)?1-a:a);
63 current = now;
64 metadata_cache_destroy();
66 g_get_current_time(&now);
67 a = now.tv_usec - current.tv_usec;
68 printf("elapsed closing: %li us\n", (a<0)?1-a:a);
69 current = now;
70 return EXIT_SUCCESS;