From: Eric Bollengier Date: Tue, 13 Feb 2007 19:58:16 +0000 (+0000) Subject: ebl Use btime_t instead of uint64_t in media patch. X-Git-Tag: Release-7.0.0~6895 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=95f96233caf6cc7ccb04224d1631d87218246db9;p=bacula%2Fbacula ebl Use btime_t instead of uint64_t in media patch. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4177 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/cats/sql_create.c b/bacula/src/cats/sql_create.c index cac0e2f4fa..e938c8988e 100644 --- a/bacula/src/cats/sql_create.c +++ b/bacula/src/cats/sql_create.c @@ -424,8 +424,8 @@ db_create_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr) mr->Slot, edit_uint64(mr->VolBytes, ed5), mr->InChanger, - edit_uint64(mr->VolReadTime, ed6), - edit_uint64(mr->VolWriteTime, ed7), + edit_int64(mr->VolReadTime, ed6), + edit_int64(mr->VolWriteTime, ed7), mr->VolParts, mr->LabelType, edit_int64(mr->StorageId, ed8), diff --git a/bacula/src/cats/sql_find.c b/bacula/src/cats/sql_find.c index a9438ca6cb..762a7bec2b 100644 --- a/bacula/src/cats/sql_find.c +++ b/bacula/src/cats/sql_find.c @@ -371,8 +371,8 @@ db_find_next_volume(JCR *jcr, B_DB *mdb, int item, bool InChanger, MEDIA_DBR *mr mr->InChanger = str_to_int64(row[20]); mr->VolParts = str_to_int64(row[21]); mr->LabelType = str_to_int64(row[22]); - mr->VolReadTime = str_to_uint64(row[23]); - mr->VolWriteTime = str_to_uint64(row[24]); + mr->VolReadTime = str_to_int64(row[23]); + mr->VolWriteTime = str_to_int64(row[24]); mr->Enabled = 1; /* ensured via query */ sql_free_result(mdb); diff --git a/bacula/src/cats/sql_update.c b/bacula/src/cats/sql_update.c index cd176c324c..918e571a99 100644 --- a/bacula/src/cats/sql_update.c +++ b/bacula/src/cats/sql_update.c @@ -363,8 +363,8 @@ db_update_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr) mr->VolMounts, mr->VolErrors, mr->VolWrites, edit_uint64(mr->MaxVolBytes, ed2), mr->VolStatus, mr->Slot, mr->InChanger, - edit_uint64(mr->VolReadTime, ed3), - edit_uint64(mr->VolWriteTime, ed4), + edit_int64(mr->VolReadTime, ed3), + edit_int64(mr->VolWriteTime, ed4), mr->VolParts, mr->LabelType, edit_int64(mr->StorageId, ed5), diff --git a/bacula/src/dird/catreq.c b/bacula/src/dird/catreq.c index 87e4293277..e884062e6f 100644 --- a/bacula/src/dird/catreq.c +++ b/bacula/src/dird/catreq.c @@ -90,8 +90,8 @@ static int send_volume_info_to_storage_daemon(JCR *jcr, BSOCK *sd, MEDIA_DBR *mr edit_uint64(mr->VolCapacityBytes, ed3), mr->VolStatus, mr->Slot, mr->MaxVolJobs, mr->MaxVolFiles, mr->InChanger, - edit_uint64(mr->VolReadTime, ed4), - edit_uint64(mr->VolWriteTime, ed5), + edit_int64(mr->VolReadTime, ed4), + edit_int64(mr->VolWriteTime, ed5), mr->EndFile, mr->EndBlock, mr->VolParts, mr->LabelType, diff --git a/bacula/src/stored/askdir.c b/bacula/src/stored/askdir.c index 25a0e55c06..e28c7b3bfa 100644 --- a/bacula/src/stored/askdir.c +++ b/bacula/src/stored/askdir.c @@ -339,8 +339,8 @@ bool dir_update_volume_info(DCR *dcr, bool label) vol->VolCatWrites, edit_uint64(vol->VolCatMaxBytes, ed2), LastWritten, vol->VolCatStatus, vol->Slot, label, InChanger, /* bool in structure */ - edit_uint64(vol->VolReadTime, ed3), - edit_uint64(vol->VolWriteTime, ed4), + edit_int64(vol->VolReadTime, ed3), + edit_int64(vol->VolWriteTime, ed4), edit_uint64(vol->VolFirstWritten, ed5), vol->VolCatParts); Dmsg1(100, ">dird: %s", dir->msg); diff --git a/bacula/src/stored/dev.c b/bacula/src/stored/dev.c index a070c01bff..6a68935c7a 100644 --- a/bacula/src/stored/dev.c +++ b/bacula/src/stored/dev.c @@ -2193,13 +2193,10 @@ void DEVICE::edit_mount_codes(POOL_MEM &omsg, const char *imsg) } /* return the last timer interval (ms) */ -int DEVICE::get_timer_count() +btime_t DEVICE::get_timer_count() { btime_t old = last_timer; - struct timeval tv; - gettimeofday(&tv, NULL); - last_timer = tv.tv_usec + tv.tv_sec * 1000000; - + last_timer = get_current_btime(); return last_timer - old; } diff --git a/bacula/src/stored/dev.h b/bacula/src/stored/dev.h index e6a5d1c16f..688eee3c14 100644 --- a/bacula/src/stored/dev.h +++ b/bacula/src/stored/dev.h @@ -177,9 +177,9 @@ struct VOLUME_CAT_INFO { uint32_t VolCatMaxFiles; /* Maximum files to write to volume */ uint64_t VolCatMaxBytes; /* Max bytes to write to volume */ uint64_t VolCatCapacityBytes; /* capacity estimate */ - uint64_t VolReadTime; /* time spent reading */ - uint64_t VolWriteTime; /* time spent writing this Volume */ - int64_t VolMediaId; /* MediaId */ + btime_t VolReadTime; /* time spent reading */ + btime_t VolWriteTime; /* time spent writing this Volume */ + int64_t VolMediaId; /* MediaId */ utime_t VolFirstWritten; /* Time of first write */ bool InChanger; /* Set if vol in current magazine */ char VolCatStatus[20]; /* Volume status */ @@ -283,13 +283,13 @@ public: btime_t last_timer; /* used by read/write/seek to get stats (usec) */ btime_t last_tick; /* contains last read/write time (usec) */ - uint64_t DevReadTime; - uint64_t DevWriteTime; + btime_t DevReadTime; + btime_t DevWriteTime; uint64_t DevWriteBytes; uint64_t DevReadBytes; /* Methods */ - int get_timer_count(); /* return the last timer interval (ms) */ + btime_t get_timer_count(); /* return the last timer interval (ms) */ int has_cap(int cap) const { return capabilities & cap; } void clear_cap(int cap) { capabilities &= ~cap; } diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index 77dbf0297e..e28200ceff 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -1,6 +1,8 @@ Technical notes on version 2.1 General: +13Feb07 +ebl Use btime_t instead of uint64_t in media patch. 11Feb07 kes Optimize the use of the database a bit in the Status dir command. Only open it when needed, ensure that if any previous database @@ -18,7 +20,7 @@ kes Apply Eric's scratch patch that moves a purged Volume to kes Apply Eric's media patch that collects read/write media times as well as byte counts. This patch requires a simultaneous upgrade of the DIR and SD. Note, there - should be some way to turn of timing. I'm not sure + should be some way to turn off timing. I'm not sure times are in Bacula units. kes Apply Eric's batch-insert patch. 09Feb07