File: mtc_test.c

package info (click to toggle)
gmpc 11.8.16-23
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,600 kB
  • sloc: ansic: 51,080; sh: 10,438; makefile: 1,748; xml: 9
file content (107 lines) | stat: -rw-r--r-- 2,214 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#include <stdio.h>
#include <stdlib.h>
#include <glib.h>
#include <libmpd/libmpd.h>
#include "gmpc-extras.h"
#include "metadata.h"
#include "metadata-cache.h"

GObject *config = NULL;
GmpcMetaWatcher *gmw = NULL;
GObject *connection = NULL;

void show_error_message(void)
{
}

void playlist3_show_error_message()
{
}


char *artists[] = {
    "Eric Clapton",
    "Clapton, Eric",
    "B.B. King",
    "Room Eleven",
    "James Brown",
    "Brown, James",
    "10cc",
    "2Pac",
    "Pantera",
    "Pärt, Arvo",
    "XERSDRXER"
};
int main(int argc, char **argv)
{
    long a;
    GTimeVal current,now;
    MetaDataResult result;
    int i=0,j=1000;
   // g_type_init();

    g_get_current_time(&current);
    metadata_cache_init();
    g_get_current_time(&now);
    a = now.tv_usec - current.tv_usec;
    printf("elapsed open db: %li us\n", (a<0)?1-a:a);
    current = now;
    /*
    for(;j>0;j--)
    {
        for(i=0;i<11;i++)
        {
            MetaData *met = NULL;
            mpd_Song *song = mpd_newSong();
            song->artist = g_strdup(artists[i]);
            result = meta_data_get_from_cache(song, META_ARTIST_ART, &met);
            if(met) meta_data_free(met);

            mpd_freeSong(song);
        }
    }

    g_get_current_time(&now);
    a = now.tv_usec - current.tv_usec;
    printf("elapsed 10.000 queries: %li us\n", (a<0)?1-a:a);
    current = now;


    for(j=10;j>0;j--)
    {
        for(i=0;i<11;i++)
        {
            MetaData *met = NULL;
            mpd_Song *song = mpd_newSong();
            song->artist = g_strdup(artists[i]);
            song->album = g_strdup("unplugged");
            result = meta_data_get_from_cache(song, META_ALBUM_ART, &met);
            if(met) meta_data_free(met);

            mpd_freeSong(song);
        }
    }
*/
    g_get_current_time(&now);
    a = now.tv_usec - current.tv_usec;
    printf("elapsed 100 queries: %li us\n", (a<0)?1-a:a);
    current = now;







    metadata_cache_destroy();

    g_get_current_time(&now);
    a = now.tv_usec - current.tv_usec;
    printf("elapsed closing: %li us\n", (a<0)?1-a:a);
    current = now;
    return EXIT_SUCCESS;
}

void pixbuf_cache_invalidate_pixbuf_entry(const gchar *url)
{
}